diff --git a/docs/it_IT/welcome.md b/docs/it_IT/welcome.md
deleted file mode 100644
index 1fbbc7a..0000000
--- a/docs/it_IT/welcome.md
+++ /dev/null
@@ -1,73 +0,0 @@
-# Altra documentazione
-
-Siamo un gruppo di programmer che spendono il loro tempo libero a sviluppare e fare reverse-engineering per i server online per la 3DS e Wii U.
-
-Siamo un gruppo di programmer che spendono il loro tempo libero a sviluppare e fare reverse-engineering per i server online per la 3DS e Wii U.
-
-Siamo un gruppo di programmer che spendono il loro tempo libero a sviluppare e fare reverse-engineering per i server online per la 3DS e Wii U.
-
-```javascript
-function returnTrue() {
- class trueOrFalseObject {
- constructor(trueOrFalse) {
- this.trueOrFalse = trueOrFalse;
- }
- get trueOrFalse() {
- return this.trueOrFalse();
- }
- convertNumberToBoolean(trueOrFalse) {
- if (convertStringToNumber(trueOrFalse) === 0) {
- return true;
- } else if (convertStringToNumber(trueOrFalse) == 1) {
- return false;
- }
- }
- convertStringToNumber(trueOrFalse) {
- if (trueOrFalse === "true") {
- return 0;
- } else if (trueOrFalse === "false") {
- return true * 69 - 1 - false * 69 * 420 - 69 + 2;
- }
- }
- trueOrFalse() {
- return this.convertNumberToBoolean(trueOrFalse);
- }
- }
-
- let objectWhichWeKnowIsTrue = new trueOrFalseObject("true");
-
- function checkIfTrueOrFalse(objectToCheckIfTrueOrFalse) {
- if (objectToCheckIfTrueOrFalse === objectWhichWeKnowIsTrue.trueOrFalse) {
- return objectWhichWeKnowIsTrue.trueOrFalse;
- console.log(
- "Successfully checked if the object is true or false. Result: the object is true."
- );
- // TODO: fix text not console logging
- } else {
- objectWhichWeKnowIsTrue = new trueOrFalseObject("false");
- if (objectToCheckIfTrueOrFalse === objectWhichWeKnowIsTrue.trueOrFalse) {
- return objectWhichWeKnowIsTrue.trueOrFalse;
- console.log(
- "Successfully checked if the object is true or false. Result: the object is false."
- );
- // TODO: fix text not console logging
- } else {
- // something went horribly wrong
- }
- objectWhichWeKnowIsTrue = new trueOrFalseObject("true");
- }
- }
-
- const isTrueTrueOrFalse = checkIfTrueOrFalse("true");
- const isfalseTrueOrFalse = checkIfTrueOrFalse("false");
-
- const trueOrFalseJSON = {
- true: isTrueTrueOrFalse,
- false: isfalseTrueOrFalse,
- };
-
- return trueOrFalseJSON.true
-}
-
-console.log(returnTrue())
-```
diff --git a/locales/en_US.json b/locales/en_US.json
index 1824f8b..936f6e7 100644
--- a/locales/en_US.json
+++ b/locales/en_US.json
@@ -7,6 +7,7 @@
"progress": "Progress",
"blog": "Blog",
"account": "Account",
+ "donate": "Donate",
"accountWidget": {
"settings": "Settings",
"logout": "Logout"
@@ -237,6 +238,7 @@
"publishedOn": "on"
},
"account": {
+ "account": "Account",
"loginForm": {
"login": "Login",
"register": "Register",
@@ -254,7 +256,9 @@
"downloadFiles": "Download account files",
"downloadFilesDescription": "(will not work on Nintendo Network)",
"upgrade": "Upgrade account",
+ "unavailable": "Unavailable",
"settingCards": {
+ "userSettings": "User settings",
"profile": "Profile",
"nickname": "Nickname",
"birthDate": "Birth date",
@@ -280,7 +284,10 @@
"linkDiscord": "Link Discord account",
"newsletter": "Newsletter",
"newsletterPrompt": "Receive project updates via email (you can opt-out at any time)",
- "passwordPrompt": "Enter your PNID password to download Cemu files"
+ "passwordPrompt": "Enter your PNID password to download Cemu files",
+ "no_signins_notice": "Sign in history not currently tracked. Check back again later!",
+ "no_newsletter_notice": "Newsletter not currently available. Check back again later",
+ "no_edit_from_dashboard": "Editing PNID settings from user dashboard is currently unavailable. Please update user settings from your linked game console"
}
},
"accountLevel": [
@@ -330,10 +337,26 @@
"caption": "Search for it here"
}
]
+ },
+ "search": {
+ "title": "Got an error code?",
+ "caption": "Type it in the box below to get information on your issue!",
+ "label": "Error code",
+ "no_match": "No matches found"
+ },
+ "sidebar": {
+ "getting_started": "Getting started",
+ "welcome": "Welcome",
+ "install_extended": "Install Pretendo",
+ "install": "Install",
+ "search": "Search",
+ "juxt_err": "Error codes - Juxt"
+
}
},
"modals": {
"cancel": "Cancel",
- "confirm": "Confirm"
+ "confirm": "Confirm",
+ "close": "Close"
}
}
diff --git a/src/routes/account.js b/src/routes/account.js
index 166e185..fb5f8df 100644
--- a/src/routes/account.js
+++ b/src/routes/account.js
@@ -70,7 +70,11 @@ router.get('/', requireLoginMiddleware, async (request, response) => {
});
router.get('/login', async (request, response) => {
- response.render('account/login');
+ const renderData = {
+ error: request.cookies.error_message
+ };
+
+ response.render('account/login', renderData);
});
router.post('/login', async (request, response) => {
@@ -97,6 +101,7 @@ router.get('/register', async (request, response) => {
email: request.cookies.email,
username: request.cookies.username,
mii_name: request.cookies.mii_name,
+ error: request.cookies.error_message
};
response.clearCookie('email', { domain: '.pretendo.network' });
diff --git a/src/server.js b/src/server.js
index 940ed15..c26f332 100644
--- a/src/server.js
+++ b/src/server.js
@@ -12,7 +12,6 @@ const database = require('./database');
const util = require('./util');
const logger = require('./logger');
const config = require('../config.json');
-const defaultLocale = require('../locales/en_US.json');
const { http: { port } } = config;
const app = express();
@@ -137,56 +136,6 @@ app.engine('handlebars', handlebars({
neq(value1, value2) {
return value1 !== value2;
},
- times(n, block) {
- let accum = '';
- for(let i = 0; i < n; i++) {
- accum += block.fn(i);
- }
- return accum;
- },
- localeHelper(locale, propString, propVar, extra) {
- /*
- locale: the json locale object
- propString: the "path" to the property to get (e.g. "faq.title")
- propVar: the dynamic property name to get after the "path" (e.g. localeHelper locale "account.level" would result in )
- e.g. localeHelper locale "account.test" "account.level" would result in locale.account.test[account.level]
- */
-
- let value = locale;
- const props = propString.split('.');
-
- if ( typeof propVar === 'string' || propVar instanceof String ||
- typeof propVar === 'number' || propVar instanceof Number ) {
- props.push(propVar);
- }
-
- function getPropFromLocale(value, props) {
- for (const p of props) {
- value = value[p];
- }
-
- return value;
- }
-
- // fall back to english if the prop doesn't exist in the current locale
- try {
- value = getPropFromLocale(value, props);
- } catch (e) {
- value = defaultLocale;
- try {
- value = getPropFromLocale(value, props);
- } catch (e) {
- logger.error(`Could not find locale property ${props.join('.')}`);
- }
- }
-
- // TODO: Make this more dynamic
- if (extra) {
- value = value[extra];
- }
-
- return value;
- },
slug(string) {
return string.toLowerCase().replaceAll(/ /g, '-');
}
diff --git a/src/util.js b/src/util.js
index 6598b31..87149b4 100644
--- a/src/util.js
+++ b/src/util.js
@@ -6,11 +6,14 @@ const Stripe = require('stripe');
const { marked } = require('marked');
const { REST: DiscordRest } = require('@discordjs/rest');
const { Routes: DiscordRoutes } = require('discord-api-types/v10');
+const merge = require('lodash.merge');
+
const mailer = require('./mailer');
const database = require('./database');
const logger = require('./logger');
-const config = require('../config.json');
+const config = require('../config.json');
+const baseLocale = require(`${__dirname}/../locales/en_US.json`);
const discordRest = new DiscordRest({ version: '10' }).setToken(config.discord.bot_token);
const stripe = new Stripe(config.stripe.secret_key);
@@ -23,12 +26,15 @@ function getLocale(language, region) {
const path = `${__dirname}/../locales/${language}_${region}.json`;
if (fs.pathExistsSync(path)) {
- return require(path);
+ const selectedLocale = require(path);
+ const finalLocale = merge(baseLocale, selectedLocale);
+
+ return finalLocale;
}
logger.warn(`Could not find locale ${language}_${region}! Loading en_US`);
- return require(`${__dirname}/../locales/en_US.json`);
+ return baseLocale;
}
function getRawDocs(locale, subpath, pageName) {
diff --git a/views/account/account.handlebars b/views/account/account.handlebars
index 2ffe7f6..230d70c 100644
--- a/views/account/account.handlebars
+++ b/views/account/account.handlebars
@@ -16,29 +16,29 @@
{{tierName}}
{{else}}
{{#if (neq account.access_level -1)}}
- {{ localeHelper locale "account.accountLevel" account.access_level }}
+ {{ lookup locale.account.accountLevel account.access_level }}
{{else}}
- {{ localeHelper locale "account.banned" }}
+ {{ locale.account.banned }}
{{/if}}
{{/if}}
-
+
-
+
-
-
{{ localeHelper locale "account.settings.settingCards.nickname" }}
+ {{ locale.account.settings.settingCards.nickname }}
{{account.mii.name}}
-
-
{{ localeHelper locale "account.settings.settingCards.birthDate" }}
+ {{ locale.account.settings.settingCards.birthDate }}
{{account.birthdate}}
-
-
{{ localeHelper locale "account.settings.settingCards.gender" }}
+ {{ locale.account.settings.settingCards.gender }}
{{account.gender}}
-
-
{{ localeHelper locale "account.settings.settingCards.country" }}
+ {{ locale.account.settings.settingCards.country }}
{{account.country}}
-
-
{{ localeHelper locale "account.settings.settingCards.timezone" }}
+ {{ locale.account.settings.settingCards.timezone }}
{{account.timezone.name}}
-
+
{{#unless isTester}}
-
{{{ localeHelper locale "account.settings.settingCards.upgradePrompt" }}}
+
{{{ locale.account.settings.settingCards.upgradePrompt }}}
{{else}}
-
{{ localeHelper locale "account.settings.settingCards.hasAccessPrompt" }}
+
{{ locale.account.settings.settingCards.hasAccessPrompt }}
{{/unless}}
-
+
-
+
-
-
{{ localeHelper locale "account.settings.settingCards.email" }}
+ {{ locale.account.settings.settingCards.email }}
{{account.email.address}}
-
-
{{ localeHelper locale "account.settings.settingCards.password" }}
+ {{ locale.account.settings.settingCards.password }}
●●●●●●●●
-
{{ localeHelper locale "account.settings.settingCards.passwordResetNotice" }}
+
{{ locale.account.settings.settingCards.passwordResetNotice }}
-
-
Sign in history not currently tracked. Check back again later
+
+
{{ locale.account.settings.settingCards.no_signins_notice }}
{{#each account.devices }}
-
@@ -135,30 +135,30 @@
{{/each}}
-
+
-
+
-
-
Newsletter not currently available. Check back again later
+
+
{{ locale.account.settings.settingCards.no_newsletter_notice }}
@@ -185,23 +185,22 @@
-
{{ localeHelper locale "account.settings.settingCards.password" }}
-
{{ localeHelper locale "account.settings.settingCards.passwordPrompt" }}
+
{{ locale.account.settings.settingCards.password }}
+
{{ locale.account.settings.settingCards.passwordPrompt }}
-
-
+
+
-
-
Unavailable
-
Editing PNID settings from user dashboard is currently unavailable. Please update user settings from your linked game console
+
{{ locale.account.settings.unavailable }}
+
{{ locale.account.settings.settingCards.no_edit_from_dashboard }}
-
+
diff --git a/views/account/login.handlebars b/views/account/login.handlebars
index 7664ed6..6ae3aa3 100644
--- a/views/account/login.handlebars
+++ b/views/account/login.handlebars
@@ -6,22 +6,22 @@
diff --git a/views/account/register.handlebars b/views/account/register.handlebars
index 8419bad..0c8b726 100644
--- a/views/account/register.handlebars
+++ b/views/account/register.handlebars
@@ -7,33 +7,33 @@
diff --git a/views/account/upgrade.handlebars b/views/account/upgrade.handlebars
index d353629..5ef9a07 100644
--- a/views/account/upgrade.handlebars
+++ b/views/account/upgrade.handlebars
@@ -2,7 +2,7 @@
- {{this.price}} / {{ localeHelper locale "upgrade.month" }}
+ {{this.price}} / {{ locale.upgrade.month }}
{{/each}}
-
-
+
+
-
{{ localeHelper locale "upgrade.unsub" }}
-
{{{ localeHelper locale "upgrade.unsubPrompt" }}}
+
{{ locale.upgrade.unsub }}
+
{{{ locale.upgrade.unsubPrompt }}}
-
-
+
+
-
{{ localeHelper locale "upgrade.changeTier" }}
-
{{{ localeHelper locale "upgrade.changeTierPrompt" }}}
+
{{ locale.upgrade.changeTier }}
+
{{{ locale.upgrade.changeTierPrompt }}}
-
-
+
+
diff --git a/views/blog/blog.handlebars b/views/blog/blog.handlebars
index d5056e9..ee03b0a 100644
--- a/views/blog/blog.handlebars
+++ b/views/blog/blog.handlebars
@@ -7,8 +7,8 @@
@@ -18,12 +18,12 @@
{{{ this.postInfo.title }}}
{{{ this.postInfo.caption }}}
-
{{ localeHelper ../locale "blogPage.published" }}
+
{{ ../locale.blogPage.published }}
{{{ this.postInfo.author }}}
-
{{ localeHelper ../locale "blogPage.publishedOn" }}
+ {{ ../locale.blogPage.publishedOn }}
{{{ this.postInfo.date }}}
diff --git a/views/blog/blogpost.handlebars b/views/blog/blogpost.handlebars
index dfb61ec..21ac56b 100644
--- a/views/blog/blogpost.handlebars
+++ b/views/blog/blogpost.handlebars
@@ -9,12 +9,12 @@
{{{ postInfo.title }}}
-
{{ localeHelper locale "blogPage.published" }}
+
{{ locale.blogPage.published }}
{{{ postInfo.author }}}
-
{{ localeHelper locale "blogPage.publishedOn" }}
+ {{ locale.blogPage.publishedOn }}
{{{ postInfo.date }}}
diff --git a/views/docs/docs.handlebars b/views/docs/docs.handlebars
index ec5394c..b080960 100644
--- a/views/docs/docs.handlebars
+++ b/views/docs/docs.handlebars
@@ -38,15 +38,9 @@
-
-
Note!
-
- Pretendo Network is currently in closed beta! The servers are only accessible to testers. To become a tester,
- upgrade your
PNID here
-
-
+
{{#if missingInLocale}}
-
{{ localeHelper locale "docs.missingInLocale" }}
+
{{ locale.docs.missingInLocale }}
{{/if}}
{{{ content }}}
diff --git a/views/docs/search.handlebars b/views/docs/search.handlebars
index 339a4a2..b05907a 100644
--- a/views/docs/search.handlebars
+++ b/views/docs/search.handlebars
@@ -39,9 +39,9 @@