From 31f6c4936ba35711b7cf621d389f946b6634068d Mon Sep 17 00:00:00 2001 From: bopol Date: Sat, 14 Nov 2020 12:30:07 +0100 Subject: [PATCH] Add new strings: quota_left, settings_saved --- src/lang/base.js | 4 +++- src/lang/en.js | 2 ++ src/lang/fr.js | 2 ++ src/lang/utils/base.txt | 4 +++- src/site/api/settings.js | 4 +++- src/site/pug/user.pug | 4 +++- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lang/base.js b/src/lang/base.js index 5eeb297..2e9fd5e 100644 --- a/src/lang/base.js +++ b/src/lang/base.js @@ -79,7 +79,9 @@ const data = { "t_return": "MISSING STRING: t_return", "t_save": "MISSING STRING: t_save", "save_and_return": "MISSING STRING: save_and_return", - "pug_restore_sync_settings": locals => "MISSING TEMPLATE: pug_restore_sync_settings" + "pug_restore_sync_settings": locals => "MISSING TEMPLATE: pug_restore_sync_settings", + "settings_saved": "MISSING STRING: settings_saved", + "quota_left": "MISSING STRING: quota_left" } module.exports = data diff --git a/src/lang/en.js b/src/lang/en.js index dd80b44..dab32e0 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -45,6 +45,7 @@ const {pug} = require("./utils/functions") data.post_counter_label = "posts" data.outgoing_follows_counter_label = "following" data.incoming_follows_counter_label = "followed by" + data.quota_left = "Quota left:" data.t_home = "Home" data.tab_timeline = "Timeline" data.tab_igtv = "IGTV" @@ -98,6 +99,7 @@ const {pug} = require("./utils/functions") data.pug_restore_sync_settings = pug(` | You can restore and sync saved settings by #[a(href="/applysettings/"+token)#restore-link bookmarking this link.] `) + data.settings_saved = "Saved." })() diff --git a/src/lang/fr.js b/src/lang/fr.js index dc4b1ad..ee94ea8 100644 --- a/src/lang/fr.js +++ b/src/lang/fr.js @@ -47,6 +47,7 @@ if (!constants.language_dev) Object.assign(data, require("./en.js")) data.post_counter_label = "posts" data.outgoing_follows_counter_label = "abonnements" data.incoming_follows_counter_label = "abonnés" + data.quota_left = "Quota restant :" data.t_home = "Accueil" data.tab_timeline = "Publications" data.tab_igtv = "IGTV" @@ -100,6 +101,7 @@ if (!constants.language_dev) Object.assign(data, require("./en.js")) data.pug_restore_sync_settings = pug(` | Vous pouvez sauvegarder et synchroniser vos préférences sauvegardées en #[a(href="/applysettings/"+token)#restore-link ajoutant ce lien à vos favoris.] `) + data.settings_saved = "Sauvegardé." })() diff --git a/src/lang/utils/base.txt b/src/lang/utils/base.txt index 84418b2..ab3bbad 100644 --- a/src/lang/utils/base.txt +++ b/src/lang/utils/base.txt @@ -88,4 +88,6 @@ display_alt_text t_return t_save save_and_return -pug_restore_sync_settings \ No newline at end of file +pug_restore_sync_settings +settings_saved +quota_left \ No newline at end of file diff --git a/src/site/api/settings.js b/src/site/api/settings.js index f9c3c14..f59af1f 100644 --- a/src/site/api/settings.js +++ b/src/site/api/settings.js @@ -1,4 +1,5 @@ const constants = require("../../lib/constants") +const lang = require("../../lang") const {render, redirect} = require("pinski/plugins") const {getSettings, getToken, generateCSRF, checkCSRF} = require("./utils/getsettings") const {getSettingsReferrer} = require("./utils/settingsreferrer") @@ -73,9 +74,10 @@ module.exports = [ if (action === "return" && url.searchParams.has("referrer")) { location = url.searchParams.get("referrer") } else { // stay + const ll = lang.get(prepared.language) const newParams = new URLSearchParams() newParams.append("status", "success") - newParams.append("message", "Saved.") + newParams.append("message", ll.settings_saved) if (url.searchParams.has("referrer")) { newParams.append("referrer", url.searchParams.get("referrer")) } diff --git a/src/site/pug/user.pug b/src/site/pug/user.pug index b8bdb9a..61eb2b9 100644 --- a/src/site/pug/user.pug +++ b/src/site/pug/user.pug @@ -96,7 +96,9 @@ html a(href="/")= ll.t_home a(href=settingsReferrer)= ll.t_settings if constants.quota.enabled - .quota Quota left: #[span#quota= remaining] + .quota + = ll.quota_left + | #[span#quota= remaining] - const hasPosts = !user.data.is_private && selectedTimeline.pages.length && selectedTimeline.pages[0].length .timeline-section(dir=ll.meta_direction)