mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-07-16 08:06:42 -05:00
Stripped down the website to remove account managment and API handling. These features may be brought back in the future when the network goes live. A few new pages such as the Cemu and FAQ pages were added along with a finished credits list
32 lines
606 B
JavaScript
32 lines
606 B
JavaScript
/*
|
|
|
|
util.js -
|
|
small commonly used utilities
|
|
|
|
*/
|
|
|
|
const fs = require('fs-extra');
|
|
const logger = require('../logger');
|
|
|
|
// Returns a locale
|
|
function getLocale(region, language) {
|
|
const path = `${__dirname}/../locales/${region}_${language}.json`;
|
|
|
|
if (fs.pathExistsSync(path)) {
|
|
return require(path);
|
|
}
|
|
|
|
logger.warn(`Could not find locale ${region}_${language}! Loading default`);
|
|
|
|
return getDefaultLocale();
|
|
}
|
|
|
|
// Returns the default locale
|
|
function getDefaultLocale(locale='default') {
|
|
return require(`${__dirname}/../locales/${locale}.json`);
|
|
}
|
|
|
|
module.exports = {
|
|
getLocale,
|
|
getDefaultLocale
|
|
}; |