From f33f773ab5f92c3246b85b8edfeca8ea26c7976e Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Dec 2023 13:44:33 +1300 Subject: [PATCH 01/58] Inital functionality pass --- client/homebrew/homebrew.jsx | 4 + server/app.js | 6 +- translation/base-localization-file.yaml | 199 ++++++++++++++++++++++++ translation/translation.js | 22 +++ 4 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 translation/base-localization-file.yaml create mode 100644 translation/translation.js diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index a08a39ea07..f2363fb256 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -13,6 +13,8 @@ const ErrorPage = require('./pages/errorPage/errorPage.jsx'); const PrintPage = require('./pages/printPage/printPage.jsx'); const AccountPage = require('./pages/accountPage/accountPage.jsx'); +const Translate = require('translation/translation.js'); + const WithRoute = (props)=>{ const params = useParams(); const [searchParams] = useSearchParams(); @@ -59,6 +61,8 @@ const Homebrew = createClass({ global.enable_themes = this.props.enable_themes; global.config = this.props.config; + Translate.addTranslationFunc(this.props.config.translationData); + return {}; }, diff --git a/server/app.js b/server/app.js index a19030b3a3..f38c490329 100644 --- a/server/app.js +++ b/server/app.js @@ -75,6 +75,9 @@ const migrateText = require('fs').readFileSync('client/homebrew/pages/home const changelogText = require('fs').readFileSync('changelog.md', 'utf8'); const faqText = require('fs').readFileSync('faq.md', 'utf8'); +const translationFile = require('fs').readFileSync('translation/base-localization-file.yaml', 'utf8'); +const translationData = yaml.load(translationFile); + String.prototype.replaceAll = function(s, r){return this.split(s).join(r);}; const defaultMetaTags = { @@ -425,7 +428,8 @@ const renderPage = async (req, res)=>{ const configuration = { local : isLocalEnvironment, publicUrl : config.get('publicUrl') ?? '', - environment : nodeEnv + environment : nodeEnv, + translationData }; const props = { version : require('./../package.json').version, diff --git a/translation/base-localization-file.yaml b/translation/base-localization-file.yaml new file mode 100644 index 0000000000..899c8a2724 --- /dev/null +++ b/translation/base-localization-file.yaml @@ -0,0 +1,199 @@ +# string translation template +yes: yes +no: no + +nav: + helpOut: help out + storageMsg: + notsignedin: youmust be signed in to a google account to transfer between the homebrewery and google drive! + signin: sign in + notnow: not now + fromgoogletohb: would you like to transfer this brew from your google drive storage back to the homebrewery? + fromhbtogoogle: would you like to transfer this brew from the homebrewery to your personal google drive storage? + saveDropdown: + autosaved: auto-saved + saving: saving + reminder: reminder... + autoSave: autosave + saved: saved + autoSaveMsg: autosave is off and you haven't saved for n minute/hour/day/month/year. + + newDoc: + helpDropdown: + needHelp: need help? + report: report issue + faq: + migrate: + + shareDropdown: + share: + view: + copyUrl: copy url + postToReddit: post to reddit + + getPdf: get pdf + + recentBrewsdropdown: + recentBrews: recent brews + edited: + viewed: + + buttonTitleAttr: Remove from Recents + + usernameDropdown: + brews: + account: + login: + localLoginPrompt: "Enter username:" + logout: + logoutMsg: Are you sure you want to log out? + +userPage: + + filters: + sortBy: + title: + createdDate: + updatedDate: + views: + searchPlaceholder: filter title/description + + sectionTitles: + 's published brews: + 's unpublished brews: + + brewInfo: + singularDate: a minute/an hour/a day/a month/a year ago + secondsDate: a few seconds ago + pluralDate: n minutes/hours/days/months/years ago + buttons: + authors: + lastViewed: + page count: + created: + share: + edit: + download: + delete: + +editorPage: + editorGroup: + toolsGroup: + undo: + redo: + brew editor: + style editor: + properties: + + buttonsGroup: + jump to location in editor: + jump to location in preview: + + brewEditorTab: + brewEditor: + snippetsGroup: + + textEditorDropdown: + textEditor: + column break: + new page: + vertical spacing: + wide block: + image: + background image: + page number: + auto-incrementing page number: + link to page: + table of contents: + add comment: + + phbDropdown: + phb: + spell: + spell list: + class feature: + note: + descriptive text box: + monster stat block: + wide monster stat block: + cover page: + artist credit: + + tablesDropdown: + tables: + class table: + half class table: + table: + wide table: + split table: + + styleEditorTab: + snippetsGroup: + styleEditorDropdown: + styleEditor: + removeDropCap: + tweakDropCap: + addComment: + + printDropdown: + print: + a4PageSize: + squarePageSize: + inkFriendly: + + propertiesTab: + properties: + brewGroup: + brew: + title: + description: + thumbnail: + tags: + add tag: + systems: + 5e: + 4e: + 3.5e: + pathfinder: + renderer: + legacy: + v3: + legacyDemoLink: click here to see the demo page for the old legacy renderer! + + authorsGroup: + authors: + none: + invitedAuthors: + inviteAuthor: + invitedMsg1: invited authors are case sensitive. + invitedMsg2: after adding an invited author, send them the edit link. there, they can choose to accept or decline the invitation. + + privacyGroup: + privacy: + publish: + publishedMsg: published homebrews will be publicly viewable and searchable (eventually...) + delete: + delete brew: + + rendererGroup: + legacy: + v3: + +sharePage: + sourceDropdown: + source: + view: + download: + clone: clone to new + +accountInfoPage: + accountInfo: + username: + lastLogin: + homebreweryInfo: + brewsOnHomebrewery: + googleInfo: + linkedToGoogle: + brewsOnGoogleDrive: + + \ No newline at end of file diff --git a/translation/translation.js b/translation/translation.js new file mode 100644 index 0000000000..0eb4032f91 --- /dev/null +++ b/translation/translation.js @@ -0,0 +1,22 @@ + +module.exports = { + addTranslationFunc : function (translationData){ + // Add translation function to String prototype + String.prototype.translate = function(_groups) { + const groups = Array.from(_groups); + const text = this.valueOf(); + let obj = translationData; + while (groups?.length > 0) { + if(obj[groups[0]]) { + obj = obj[groups[0]]; + groups.shift(); + continue; + } + break; + } + + if(obj[text] && obj[text].length > 0) return obj[text]; + return text; + }; + } +}; \ No newline at end of file From fd6d17ab23f8257ee49aa576741e659dc0f6b594 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Dec 2023 13:46:53 +1300 Subject: [PATCH 02/58] Update Account menu strings --- client/homebrew/navbar/account.navitem.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/homebrew/navbar/account.navitem.jsx b/client/homebrew/navbar/account.navitem.jsx index 6b412c368d..07924ef70b 100644 --- a/client/homebrew/navbar/account.navitem.jsx +++ b/client/homebrew/navbar/account.navitem.jsx @@ -3,6 +3,8 @@ const createClass = require('create-react-class'); const Nav = require('naturalcrit/nav/nav.jsx'); const request = require('superagent'); +const translateOpts = ['nav', 'usernameDropdown']; + const Account = createClass({ displayName : 'AccountNavItem', getInitialState : function() { @@ -20,7 +22,7 @@ const Account = createClass({ }, handleLogout : function(){ - if(confirm('Are you sure you want to log out?')) { + if(confirm('logoutMsg'.translate(translateOpts))) { // Reset divider position window.localStorage.removeItem('naturalcrit-pane-split'); // Clear login cookie @@ -38,7 +40,7 @@ const Account = createClass({ }, localLogin : async function(){ - const username = prompt('Enter username:'); + const username = prompt('localLoginPrompt'.translate(translateOpts)); if(!username) {return;} const expiry = new Date; @@ -74,7 +76,7 @@ const Account = createClass({ color='yellow' icon='fas fa-beer' > - brews + {'brews'.translate(translateOpts)} - account + {'account'.translate(translateOpts)} - logout + {'logout'.translate(translateOpts)} ; } @@ -99,14 +101,14 @@ const Account = createClass({ // LOCAL ONLY if(global.config.local) { return - login + {'login'.translate(translateOpts)} ; }; // Logged out // Production site return - login + {'login'.translate(translateOpts)} ; } }); From 83ba1fbb6abb24f3adfb2310b72b500f7368e479 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Dec 2023 14:12:31 +1300 Subject: [PATCH 03/58] New menu item --- client/homebrew/navbar/newbrew.navitem.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/homebrew/navbar/newbrew.navitem.jsx b/client/homebrew/navbar/newbrew.navitem.jsx index 2cbbce4660..76de7c7812 100644 --- a/client/homebrew/navbar/newbrew.navitem.jsx +++ b/client/homebrew/navbar/newbrew.navitem.jsx @@ -1,11 +1,13 @@ const React = require('react'); const Nav = require('naturalcrit/nav/nav.jsx'); +const translateOpts = ['nav', 'newDoc']; + module.exports = function(props){ return - new + {'new'.translate(translateOpts)} ; }; From d33a49da22800faf99928061f8a95daffcc72e56 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 21 Dec 2023 14:17:33 +1300 Subject: [PATCH 04/58] Recent Brews update for translation --- client/homebrew/navbar/recent.navitem.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index 431bdd8dfd..642341a0db 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -8,6 +8,7 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const EDIT_KEY = 'homebrewery-recently-edited'; const VIEW_KEY = 'homebrewery-recently-viewed'; +const translateOpts = ['nav', 'recentBrewsdropdown']; const RecentItems = createClass({ DisplayName : 'RecentItems', @@ -154,11 +155,15 @@ const RecentItems = createClass({ return <> {(this.props.showEdit && this.props.showView) ? - edited : null } + + {'edited'.translate(translateOpts)} + : null } {this.props.showEdit ? makeItems(this.state.edit) : null } {(this.props.showEdit && this.props.showView) ? - viewed : null } + + {'viewed'.translate(translateOpts)} + : null } {this.props.showView ? makeItems(this.state.view) : null } ; @@ -181,7 +186,7 @@ module.exports = { return ; }, @@ -190,7 +195,7 @@ module.exports = { return ; }, @@ -199,7 +204,7 @@ module.exports = { return ; From 6e6793d64e4c01efd7d03fecb3c59fa8a790b049 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 28 Dec 2023 10:35:08 +1300 Subject: [PATCH 05/58] Name change to `locale` --- client/homebrew/homebrew.jsx | 8 ++++---- {translation => locale}/base-localization-file.yaml | 1 + translation/translation.js => locale/localization.js | 6 +++--- server/app.js | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) rename {translation => locale}/base-localization-file.yaml (99%) rename translation/translation.js => locale/localization.js (75%) diff --git a/client/homebrew/homebrew.jsx b/client/homebrew/homebrew.jsx index f2363fb256..a3cf01fedf 100644 --- a/client/homebrew/homebrew.jsx +++ b/client/homebrew/homebrew.jsx @@ -13,7 +13,7 @@ const ErrorPage = require('./pages/errorPage/errorPage.jsx'); const PrintPage = require('./pages/printPage/printPage.jsx'); const AccountPage = require('./pages/accountPage/accountPage.jsx'); -const Translate = require('translation/translation.js'); +const Localize = require('locale/localization.js'); const WithRoute = (props)=>{ const params = useParams(); @@ -61,7 +61,7 @@ const Homebrew = createClass({ global.enable_themes = this.props.enable_themes; global.config = this.props.config; - Translate.addTranslationFunc(this.props.config.translationData); + Localize.addTranslationFunc(this.props.config.localeData); return {}; }, @@ -83,8 +83,8 @@ const Homebrew = createClass({ } /> } /> } /> - } /> - } /> + } /> + } /> diff --git a/translation/base-localization-file.yaml b/locale/base-localization-file.yaml similarity index 99% rename from translation/base-localization-file.yaml rename to locale/base-localization-file.yaml index 899c8a2724..e56fb163b1 100644 --- a/translation/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -19,6 +19,7 @@ nav: autoSaveMsg: autosave is off and you haven't saved for n minute/hour/day/month/year. newDoc: + new: helpDropdown: needHelp: need help? report: report issue diff --git a/translation/translation.js b/locale/localization.js similarity index 75% rename from translation/translation.js rename to locale/localization.js index 0eb4032f91..8e4a00e636 100644 --- a/translation/translation.js +++ b/locale/localization.js @@ -1,11 +1,11 @@ module.exports = { - addTranslationFunc : function (translationData){ + addTranslationFunc : function (localeData){ // Add translation function to String prototype String.prototype.translate = function(_groups) { - const groups = Array.from(_groups); const text = this.valueOf(); - let obj = translationData; + const groups = _groups ? Array.from(_groups) : []; + let obj = localeData; while (groups?.length > 0) { if(obj[groups[0]]) { obj = obj[groups[0]]; diff --git a/server/app.js b/server/app.js index f38c490329..0e0cc9a79c 100644 --- a/server/app.js +++ b/server/app.js @@ -75,8 +75,8 @@ const migrateText = require('fs').readFileSync('client/homebrew/pages/home const changelogText = require('fs').readFileSync('changelog.md', 'utf8'); const faqText = require('fs').readFileSync('faq.md', 'utf8'); -const translationFile = require('fs').readFileSync('translation/base-localization-file.yaml', 'utf8'); -const translationData = yaml.load(translationFile); +const localeFile = require('fs').readFileSync('locale/base-localization-file.yaml', 'utf8'); +const localeData = yaml.load(localeFile); String.prototype.replaceAll = function(s, r){return this.split(s).join(r);}; @@ -429,7 +429,7 @@ const renderPage = async (req, res)=>{ local : isLocalEnvironment, publicUrl : config.get('publicUrl') ?? '', environment : nodeEnv, - translationData + localeData }; const props = { version : require('./../package.json').version, From 7f01546ee4cb107d9b6d7c0cfeca9f7995469141 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 28 Dec 2023 10:50:39 +1300 Subject: [PATCH 06/58] Add default functions --- locale/localization.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/locale/localization.js b/locale/localization.js index 8e4a00e636..995b8442f3 100644 --- a/locale/localization.js +++ b/locale/localization.js @@ -2,7 +2,7 @@ module.exports = { addTranslationFunc : function (localeData){ // Add translation function to String prototype - String.prototype.translate = function(_groups) { + String.prototype.translate = function(_groups = String.prototype.getTranslationDefaults()) { const text = this.valueOf(); const groups = _groups ? Array.from(_groups) : []; let obj = localeData; @@ -18,5 +18,13 @@ module.exports = { if(obj[text] && obj[text].length > 0) return obj[text]; return text; }; + + // Add defaults + String.prototype.getTranslationDefaults = function() { + return String.prototype.translationDefaults || []; + }; + String.prototype.setTranslationDefaults = function(_groups=[]) { + String.prototype.translationDefaults = _groups; + }; } }; \ No newline at end of file From 336118919bf0aafb2bde7d9dd91807f9b4603a27 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Thu, 28 Dec 2023 10:52:59 +1300 Subject: [PATCH 07/58] Update Nav items --- client/homebrew/navbar/account.navitem.jsx | 15 ++++++++------- client/homebrew/navbar/newbrew.navitem.jsx | 3 ++- client/homebrew/navbar/recent.navitem.jsx | 11 ++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/client/homebrew/navbar/account.navitem.jsx b/client/homebrew/navbar/account.navitem.jsx index 07924ef70b..f36f52ff42 100644 --- a/client/homebrew/navbar/account.navitem.jsx +++ b/client/homebrew/navbar/account.navitem.jsx @@ -8,6 +8,7 @@ const translateOpts = ['nav', 'usernameDropdown']; const Account = createClass({ displayName : 'AccountNavItem', getInitialState : function() { + ''.setTranslationDefaults(translateOpts); return { url : '' }; @@ -22,7 +23,7 @@ const Account = createClass({ }, handleLogout : function(){ - if(confirm('logoutMsg'.translate(translateOpts))) { + if(confirm('logoutMsg'.translate())) { // Reset divider position window.localStorage.removeItem('naturalcrit-pane-split'); // Clear login cookie @@ -40,7 +41,7 @@ const Account = createClass({ }, localLogin : async function(){ - const username = prompt('localLoginPrompt'.translate(translateOpts)); + const username = prompt('localLoginPrompt'.translate()); if(!username) {return;} const expiry = new Date; @@ -76,7 +77,7 @@ const Account = createClass({ color='yellow' icon='fas fa-beer' > - {'brews'.translate(translateOpts)} + {'brews'.translate()} - {'account'.translate(translateOpts)} + {'account'.translate()} - {'logout'.translate(translateOpts)} + {'logout'.translate()} ; } @@ -101,14 +102,14 @@ const Account = createClass({ // LOCAL ONLY if(global.config.local) { return - {'login'.translate(translateOpts)} + {'login'.translate()} ; }; // Logged out // Production site return - {'login'.translate(translateOpts)} + {'login'.translate()} ; } }); diff --git a/client/homebrew/navbar/newbrew.navitem.jsx b/client/homebrew/navbar/newbrew.navitem.jsx index 76de7c7812..5617d1a46b 100644 --- a/client/homebrew/navbar/newbrew.navitem.jsx +++ b/client/homebrew/navbar/newbrew.navitem.jsx @@ -4,10 +4,11 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const translateOpts = ['nav', 'newDoc']; module.exports = function(props){ + ''.setTranslationDefaults(translateOpts); return - {'new'.translate(translateOpts)} + {'new'.translate()} ; }; diff --git a/client/homebrew/navbar/recent.navitem.jsx b/client/homebrew/navbar/recent.navitem.jsx index 642341a0db..f94ab28a49 100644 --- a/client/homebrew/navbar/recent.navitem.jsx +++ b/client/homebrew/navbar/recent.navitem.jsx @@ -21,6 +21,7 @@ const RecentItems = createClass({ }, getInitialState : function() { + ''.setTranslationDefaults(translateOpts); return { showDropdown : false, edit : [], @@ -156,13 +157,13 @@ const RecentItems = createClass({ return <> {(this.props.showEdit && this.props.showView) ? - {'edited'.translate(translateOpts)} + {'edited'.translate()} : null } {this.props.showEdit ? makeItems(this.state.edit) : null } {(this.props.showEdit && this.props.showView) ? - {'viewed'.translate(translateOpts)} + {'viewed'.translate()} : null } {this.props.showView ? makeItems(this.state.view) : null } @@ -186,7 +187,7 @@ module.exports = { return ; }, @@ -195,7 +196,7 @@ module.exports = { return ; }, @@ -204,7 +205,7 @@ module.exports = { return ; From 2afd876cb1426f30ac08c8d6aeb93705732c68ed Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 18:24:53 +1300 Subject: [PATCH 08/58] Update Reddit Nav Item --- client/homebrew/navbar/reddit.navitem.jsx | 5 ++++- locale/base-localization-file.yaml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/homebrew/navbar/reddit.navitem.jsx b/client/homebrew/navbar/reddit.navitem.jsx index 15bc1696e4..755fde24af 100644 --- a/client/homebrew/navbar/reddit.navitem.jsx +++ b/client/homebrew/navbar/reddit.navitem.jsx @@ -6,6 +6,8 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const MAX_URL_SIZE = 2083; const MAIN_URL = 'https://www.reddit.com/r/UnearthedArcana/submit?selftext=true'; +const translateOpts = ['nav']; + const RedditShare = createClass({ displayName : 'RedditShareNavItem', @@ -36,8 +38,9 @@ const RedditShare = createClass({ render : function(){ + ''.setTranslationDefaults(translateOpts); return - share on reddit + {'postToReddit'.translate()} ; }, diff --git a/locale/base-localization-file.yaml b/locale/base-localization-file.yaml index e56fb163b1..485e240e52 100644 --- a/locale/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -30,7 +30,7 @@ nav: share: view: copyUrl: copy url - postToReddit: post to reddit + postToReddit: share on reddit getPdf: get pdf From 19c7dd52c9d757d64b3a30f57cb29a152e1c86ad Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 18:27:02 +1300 Subject: [PATCH 09/58] Update Patreon Nav item --- client/homebrew/navbar/patreon.navitem.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/homebrew/navbar/patreon.navitem.jsx b/client/homebrew/navbar/patreon.navitem.jsx index 92b42dcebe..e3efa55faa 100644 --- a/client/homebrew/navbar/patreon.navitem.jsx +++ b/client/homebrew/navbar/patreon.navitem.jsx @@ -1,13 +1,16 @@ const React = require('react'); const Nav = require('naturalcrit/nav/nav.jsx'); +const translateOpts = ['nav']; + module.exports = function(props){ + ''.setTranslationDefaults(translateOpts); return - help out + {'helpOut'.translate()} ; }; From 20d89c9ba2089050d8206970847e58e3014d1730 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 18:27:11 +1300 Subject: [PATCH 10/58] Update Print Nav item --- client/homebrew/navbar/print.navitem.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/homebrew/navbar/print.navitem.jsx b/client/homebrew/navbar/print.navitem.jsx index 4907cad734..db58aa7297 100644 --- a/client/homebrew/navbar/print.navitem.jsx +++ b/client/homebrew/navbar/print.navitem.jsx @@ -2,8 +2,11 @@ const React = require('react'); const createClass = require('create-react-class'); const Nav = require('naturalcrit/nav/nav.jsx'); +const translateOpts = ['nav']; + module.exports = function(props){ + ''.setTranslationDefaults(translateOpts); return - get PDF + {'getPdf'.translate()} ; }; From 88f34b81d417fe53b37d40ffb30cef0bd60b9003 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 19:26:48 +1300 Subject: [PATCH 11/58] Fix typo --- locale/base-localization-file.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/base-localization-file.yaml b/locale/base-localization-file.yaml index 485e240e52..ac8b7d22f1 100644 --- a/locale/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -5,7 +5,7 @@ no: no nav: helpOut: help out storageMsg: - notsignedin: youmust be signed in to a google account to transfer between the homebrewery and google drive! + notsignedin: you must be signed in to a google account to transfer between the homebrewery and google drive! signin: sign in notnow: not now fromgoogletohb: would you like to transfer this brew from your google drive storage back to the homebrewery? From efdea9cacde572d58432d314a9ee81a6b64c4c85 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 22:00:09 +1300 Subject: [PATCH 12/58] Fix Reddit Nav item --- client/homebrew/navbar/reddit.navitem.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/navbar/reddit.navitem.jsx b/client/homebrew/navbar/reddit.navitem.jsx index 755fde24af..3acbc53fab 100644 --- a/client/homebrew/navbar/reddit.navitem.jsx +++ b/client/homebrew/navbar/reddit.navitem.jsx @@ -6,7 +6,7 @@ const Nav = require('naturalcrit/nav/nav.jsx'); const MAX_URL_SIZE = 2083; const MAIN_URL = 'https://www.reddit.com/r/UnearthedArcana/submit?selftext=true'; -const translateOpts = ['nav']; +const translateOpts = ['nav', 'shareDropdown']; const RedditShare = createClass({ From 6efb23c0a70bed0959a65eb61101feb104c86a9d Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 22:01:21 +1300 Subject: [PATCH 13/58] Update Help Nav items --- client/homebrew/navbar/help.navitem.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/homebrew/navbar/help.navitem.jsx b/client/homebrew/navbar/help.navitem.jsx index 952681fd88..fe00e05810 100644 --- a/client/homebrew/navbar/help.navitem.jsx +++ b/client/homebrew/navbar/help.navitem.jsx @@ -5,10 +5,13 @@ const dedent = require('dedent-tabs').default; const Nav = require('naturalcrit/nav/nav.jsx'); +const translateOpts = ['nav', 'helpDropdown']; + module.exports = function(props){ + ''.setTranslationDefaults(translateOpts); return - need help? + {'needHelp'.translate()} - report issue + {'report'.translate()} - FAQ + {'faq'.translate()} - migrate + {'migrate'.translate()} ; }; From ba6cb7946f0f6080cc7a9b96e1ddbb66f47ba952 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Mon, 8 Jan 2024 22:01:48 +1300 Subject: [PATCH 14/58] Update EditPage Share dropdown --- client/homebrew/pages/editPage/editPage.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index bb9b5ca528..388cf0d680 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -344,6 +344,8 @@ const EditPage = createClass({ renderNavbar : function(){ const shareLink = this.processShareId(); + ''.setTranslationDefaults(['nav', 'shareDropdown']); + return {this.state.brew.title} @@ -362,16 +364,16 @@ const EditPage = createClass({ - share + {'share'.translate()} - view + {'view'.translate()} {navigator.clipboard.writeText(`${global.config.publicUrl}/share/${shareLink}`);}}> - copy url + {'copyUrl'.translate()} - post to reddit + {'postToReddit'.translate()} From 569867f9469c4791ca06770af095a16d06f6ffe6 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 9 Jan 2024 19:31:19 +1300 Subject: [PATCH 15/58] Update for Edit Page save messages --- client/homebrew/pages/editPage/editPage.jsx | 13 +++++++------ locale/base-localization-file.yaml | 11 +++++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 388cf0d680..9e8e6e032b 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -268,13 +268,14 @@ const EditPage = createClass({ }, renderSaveButton : function(){ + ''.setTranslationDefaults(['nav', 'saveDropdown']); if(this.state.autoSaveWarning && this.hasChanges()){ this.setAutosaveWarning(); const elapsedTime = Math.round((new Date() - this.state.unsavedTime) / 1000 / 60); - const text = elapsedTime == 0 ? 'Autosave is OFF.' : `Autosave is OFF, and you haven't saved for ${elapsedTime} minutes.`; + const text = elapsedTime == 0 ? 'autoSaveOff'.translate() : `${'autoSaveMsg'.translate()} ${elapsedTime} ${'autoSaveMsgDuration'.translate()}.`; return - Reminder... + {'reminder'.translate()}
{text}
@@ -282,16 +283,16 @@ const EditPage = createClass({ } if(this.state.isSaving){ - return saving...; + return {'saving'.translate()}; } if(this.state.isPending && this.hasChanges()){ - return Save Now; + return {'saveNow'.translate()}; } if(!this.state.isPending && !this.state.isSaving && this.state.autoSave){ - return auto-saved.; + return {'autosaved'.translate()}; } if(!this.state.isPending && !this.state.isSaving){ - return saved.; + return {'saved'.translate()}; } }, diff --git a/locale/base-localization-file.yaml b/locale/base-localization-file.yaml index ac8b7d22f1..a1afdc9075 100644 --- a/locale/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -11,12 +11,15 @@ nav: fromgoogletohb: would you like to transfer this brew from your google drive storage back to the homebrewery? fromhbtogoogle: would you like to transfer this brew from the homebrewery to your personal google drive storage? saveDropdown: - autosaved: auto-saved - saving: saving + autosaved: auto-saved. + saving: saving... reminder: reminder... autoSave: autosave - saved: saved - autoSaveMsg: autosave is off and you haven't saved for n minute/hour/day/month/year. + saveNow: Save Now + saved: saved. + autoSaveMsg: `Autosave is OFF, and you haven't saved for ` + autoSaveMsgDuration: 'minutes.' + autoSaveOff: Autosave is OFF. newDoc: new: From a672c485b1d0fb35992cac7852f8261dc2ed4f68 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 9 Jan 2024 20:10:38 +1300 Subject: [PATCH 16/58] Fix Autosave warning message --- locale/base-localization-file.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/base-localization-file.yaml b/locale/base-localization-file.yaml index a1afdc9075..ba5fa7adf4 100644 --- a/locale/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -17,7 +17,7 @@ nav: autoSave: autosave saveNow: Save Now saved: saved. - autoSaveMsg: `Autosave is OFF, and you haven't saved for ` + autoSaveMsg: Autosave is OFF, and you haven't saved for autoSaveMsgDuration: 'minutes.' autoSaveOff: Autosave is OFF. From d1d8da577ed1346bb8bc1163ceedbb531b7b3ef4 Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Tue, 9 Jan 2024 20:11:04 +1300 Subject: [PATCH 17/58] Update Autosave button --- client/homebrew/pages/editPage/editPage.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 9e8e6e032b..7cc8de66b9 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -319,8 +319,9 @@ const EditPage = createClass({ }, renderAutoSaveButton : function(){ + ''.setTranslationDefaults(['nav', 'saveDropdown']); return - Autosave + {'autosave'.translate()} ; }, From 1bd10b985c0aa175cad880fc7e3ae90f664d0e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 19:43:10 +0100 Subject: [PATCH 18/58] error and metadata nav items updated --- client/homebrew/navbar/error-navitem.jsx | 29 ++++++++++----------- client/homebrew/navbar/metadata.navitem.jsx | 21 ++++++++------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/client/homebrew/navbar/error-navitem.jsx b/client/homebrew/navbar/error-navitem.jsx index eb2872c226..44c4ec0b95 100644 --- a/client/homebrew/navbar/error-navitem.jsx +++ b/client/homebrew/navbar/error-navitem.jsx @@ -3,8 +3,11 @@ const React = require('react'); const Nav = require('naturalcrit/nav/nav.jsx'); const createClass = require('create-react-class'); +const translateOpts = ['nav', 'errorMsg']; + const ErrorNavItem = createClass({ getDefaultProps : function() { + ''.setTranslationDefaults(translateOpts); return { error : '', parent : null @@ -35,47 +38,43 @@ const ErrorNavItem = createClass({ if(status === 409) { return - Oops! + {'oops'.translate()}
- {message ?? 'Conflict: please refresh to get latest changes'} + {message ?? 'conflict'.translate()}
; } else if(status === 412) { return - Oops! + {'oops'.translate()}
- {message ?? 'Your client is out of date. Please save your changes elsewhere and refresh.'} + {message ?? 'outOfDate'.translate()}
; } if(response.req.url.match(/^\/api.*Google.*$/m)){ return - Oops! + {'oops'.translate()}
- Looks like your Google credentials have - expired! Visit our log in page to sign out - and sign back in with Google, - then try saving again! + {'expiredCredentials'.translate()}
- Sign In + {'signIn'.translate()}
- Not Now + {'notNow'.translate()}
; } return - Oops! + {'oops'.translate()}
- Looks like there was a problem saving.
- Report the issue - here + {'problemSaving'.translate()} + {'problemSaving2'.translate()} .
; diff --git a/client/homebrew/navbar/metadata.navitem.jsx b/client/homebrew/navbar/metadata.navitem.jsx index f4a09e1430..e0c8a16b81 100644 --- a/client/homebrew/navbar/metadata.navitem.jsx +++ b/client/homebrew/navbar/metadata.navitem.jsx @@ -4,11 +4,12 @@ const _ = require('lodash'); const Moment = require('moment'); const Nav = require('naturalcrit/nav/nav.jsx'); - +const translateOpts = ['nav', 'errorMsg']; const MetadataNav = createClass({ displayName : 'MetadataNav', getDefaultProps : function() { + ''.setTranslationDefaults(translateOpts); return { }; }, @@ -29,7 +30,7 @@ const MetadataNav = createClass({ }, getAuthors : function(){ - if(!this.props.brew.authors || this.props.brew.authors.length == 0) return 'No authors'; + if(!this.props.brew.authors || this.props.brew.authors.length == 0) return 'noAuthors'.translate(); return <> {this.props.brew.authors.map((author, idx, arr)=>{ const spacer = arr.length - 1 == idx ? <> : , ; @@ -39,7 +40,7 @@ const MetadataNav = createClass({ }, getTags : function(){ - if(!this.props.brew.tags || this.props.brew.tags.length == 0) return 'No tags'; + if(!this.props.brew.tags || this.props.brew.tags.length == 0) return 'noTags'.translate(); return <> {this.props.brew.tags.map((tag, idx)=>{ return {tag}; @@ -48,30 +49,30 @@ const MetadataNav = createClass({ }, getSystems : function(){ - if(!this.props.brew.systems || this.props.brew.systems.length == 0) return 'No systems'; + if(!this.props.brew.systems || this.props.brew.systems.length == 0) return 'noSystems'.translate(); return this.props.brew.systems.join(', '); }, renderMetaWindow : function(){ return
-

Description

-

{this.props.brew.description || 'No description.'}

+

{'description'.translate()}

+

{this.props.brew.description || 'noDescription'.translate()}

-

Authors

+

{'authors'.translate()}

{this.getAuthors()}

-

Tags

+

{'tags'.translate()}

{this.getTags()}

-

Systems

+

{'systems'.translate()}

{this.getSystems()}

-

Updated

+

{'updated'.translate()}

{Moment(this.props.brew.updatedAt).fromNow()}

; From d1011b99308167e0162c38d96d2e24aad2d1b630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 20:32:32 +0100 Subject: [PATCH 19/58] new syntax fix --- client/homebrew/navbar/error-navitem.jsx | 14 +++++++------- client/homebrew/navbar/help.navitem.jsx | 2 +- client/homebrew/navbar/recent.navitem.jsx | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/homebrew/navbar/error-navitem.jsx b/client/homebrew/navbar/error-navitem.jsx index 44c4ec0b95..a6581b3b1e 100644 --- a/client/homebrew/navbar/error-navitem.jsx +++ b/client/homebrew/navbar/error-navitem.jsx @@ -38,14 +38,14 @@ const ErrorNavItem = createClass({ if(status === 409) { return - {'oops'.translate()} + {'Oops!'.translate()}
{message ?? 'conflict'.translate()}
; } else if(status === 412) { return - {'oops'.translate()} + {'Oops!'.translate()}
{message ?? 'outOfDate'.translate()}
@@ -54,27 +54,27 @@ const ErrorNavItem = createClass({ if(response.req.url.match(/^\/api.*Google.*$/m)){ return - {'oops'.translate()} + {'Oops!'.translate()}
{'expiredCredentials'.translate()}
- {'signIn'.translate()} + {'sign in'.translate()}
- {'notNow'.translate()} + {'not now'.translate()}
; } return - {'oops'.translate()} + {'Oops!'.translate()} ; diff --git a/client/homebrew/navbar/help.navitem.jsx b/client/homebrew/navbar/help.navitem.jsx index fe00e05810..48594b0d21 100644 --- a/client/homebrew/navbar/help.navitem.jsx +++ b/client/homebrew/navbar/help.navitem.jsx @@ -21,7 +21,7 @@ module.exports = function(props){ - **Issue** : `)}`} newTab={true} rel='noopener noreferrer'> - {'report'.translate()} + {'report issue'.translate()}
{brew.title || '[ no title ]'} {Moment(brew.ts).fromNow()} -
{this.removeItem(`${brew.url}`, e);}}>
+
{this.removeItem(`${brew.url}`, e);}}>
; }); }; From e8300491672266a04383560faa07540841277bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 20:32:52 +0100 Subject: [PATCH 20/58] yaml update --- locale/base-localization-file.yaml | 272 +++++++++++++++-------------- 1 file changed, 143 insertions(+), 129 deletions(-) diff --git a/locale/base-localization-file.yaml b/locale/base-localization-file.yaml index ba5fa7adf4..bb3c433b8b 100644 --- a/locale/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -1,75 +1,81 @@ # string translation template yes: yes -no: no +no: no nav: - helpOut: help out - storageMsg: - notsignedin: you must be signed in to a google account to transfer between the homebrewery and google drive! - signin: sign in - notnow: not now - fromgoogletohb: would you like to transfer this brew from your google drive storage back to the homebrewery? - fromhbtogoogle: would you like to transfer this brew from the homebrewery to your personal google drive storage? + help out: help out + storageMsg: + notSignedIn: you must be signed in to a google account to transfer between the homebrewery and google drive! + fromGoogleToHb: would you like to transfer this brew from your google drive storage back to the homebrewery? + fromHbToGoogle: would you like to transfer this brew from the homebrewery to your personal google drive storage? saveDropdown: - autosaved: auto-saved. - saving: saving... - reminder: reminder... - autoSave: autosave - saveNow: Save Now - saved: saved. + auto-saved.: auto-saved. + saving...: saving... + reminder...: reminder... + autosave: autosave + Save Now: Save Now + saved.: saved. autoSaveMsg: Autosave is OFF, and you haven't saved for - autoSaveMsgDuration: 'minutes.' + autoSaveMsgDuration: "minutes." autoSaveOff: Autosave is OFF. - - newDoc: - new: + errorMsg: + Oops!: + conflict: "Conflict: please refresh to get latest change" + outOfDate: Your client is out of date. Please save your changes elsewhere and refresh. + expiredCredentials: Looks like your Google credentials have expired! Visit our log in page to sign out and sign back in with Google, then try saving again! + sign in: + not now: + problemSaving: Looks like there was a problem saving.
Report the issue + here: + + newDoc: + new: helpDropdown: - needHelp: need help? - report: report issue - faq: - migrate: + need help?: + report issue: + faq: + migrate: shareDropdown: - share: - view: - copyUrl: copy url - postToReddit: share on reddit + share: + view: + copy url: + share on reddit: - getPdf: get pdf + get pdf: recentBrewsdropdown: - recentBrews: recent brews - edited: - viewed: + recent brews: + edited: + viewed: - buttonTitleAttr: Remove from Recents + removeRecents: Remove from Recents usernameDropdown: - brews: - account: - login: - localLoginPrompt: "Enter username:" - logout: + brews: + account: + login: + localLoginPrompt: "Enter username:" + logout: logoutMsg: Are you sure you want to log out? userPage: - filters: - sortBy: - title: - createdDate: - updatedDate: - views: + sortBy: + title: + createdDate: + updatedDate: + views: searchPlaceholder: filter title/description sectionTitles: - 's published brews: - 's unpublished brews: + 's published brews: + 's unpublished brews: brewInfo: singularDate: a minute/an hour/a day/a month/a year ago secondsDate: a few seconds ago - pluralDate: n minutes/hours/days/months/years ago + pluralDate: n minutes/hours/days/months/years ago buttons: authors: lastViewed: @@ -83,121 +89,129 @@ userPage: editorPage: editorGroup: toolsGroup: - undo: - redo: - brew editor: - style editor: - properties: + undo: + redo: + brew editor: + style editor: + properties: buttonsGroup: - jump to location in editor: + jump to location in editor: jump to location in preview: - brewEditorTab: + brewEditorTab: brewEditor: snippetsGroup: - textEditorDropdown: textEditor: - column break: - new page: - vertical spacing: - wide block: - image: - background image: - page number: - auto-incrementing page number: - link to page: - table of contents: + column break: + new page: + vertical spacing: + wide block: + image: + background image: + page number: + auto-incrementing page number: + link to page: + table of contents: add comment: - phbDropdown: + phbDropdown: phb: - spell: - spell list: - class feature: - note: - descriptive text box: - monster stat block: - wide monster stat block: - cover page: - artist credit: - - tablesDropdown: - tables: - class table: - half class table: - table: - wide table: - split table: - - styleEditorTab: - snippetsGroup: - styleEditorDropdown: + spell: + spell list: + class feature: + note: + descriptive text box: + monster stat block: + wide monster stat block: + cover page: + artist credit: + + tablesDropdown: + tables: + class table: + half class table: + table: + wide table: + split table: + + styleEditorTab: + snippetsGroup: + styleEditorDropdown: styleEditor: - removeDropCap: - tweakDropCap: - addComment: + removeDropCap: + tweakDropCap: + addComment: printDropdown: - print: - a4PageSize: - squarePageSize: + print: + a4PageSize: + squarePageSize: inkFriendly: propertiesTab: properties: brewGroup: - brew: - title: - description: - thumbnail: - tags: - add tag: - systems: - 5e: - 4e: - 3.5e: - pathfinder: - renderer: - legacy: - v3: + brew: + title: + description: + thumbnail: + tags: + add tag: + systems: + 5e: + 4e: + 3.5e: + pathfinder: + renderer: + legacy: + v3: legacyDemoLink: click here to see the demo page for the old legacy renderer! - authorsGroup: - authors: - none: - invitedAuthors: - inviteAuthor: + authorsGroup: + authors: + none: + invitedAuthors: + inviteAuthor: invitedMsg1: invited authors are case sensitive. invitedMsg2: after adding an invited author, send them the edit link. there, they can choose to accept or decline the invitation. - privacyGroup: - privacy: - publish: + privacyGroup: + privacy: + publish: publishedMsg: published homebrews will be publicly viewable and searchable (eventually...) - delete: - delete brew: + delete: + delete brew: - rendererGroup: - legacy: - v3: + rendererGroup: + legacy: + v3: sharePage: + metadataWindow: + Authors: + no authors: + Systems: + no systems: + Tags: + no tags: + Description: + No description.: + updated: + sourceDropdown: source: - view: - download: + view: + download: clone: clone to new -accountInfoPage: - accountInfo: - username: - lastLogin: - homebreweryInfo: +accountInfoPage: + accountInfo: + username: + lastLogin: + homebreweryInfo: brewsOnHomebrewery: googleInfo: - linkedToGoogle: - brewsOnGoogleDrive: - - \ No newline at end of file + linkedToGoogle: + brewsOnGoogleDrive: From ebb2cfd527bbdb8e9c1428e5712487df8007ad24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 21:53:33 +0100 Subject: [PATCH 21/58] brewRenderer folder done --- .../homebrew/brewRenderer/errorBar/errorBar.jsx | 17 ++++++++++------- .../notificationPopup/notificationPopup.jsx | 7 +++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/client/homebrew/brewRenderer/errorBar/errorBar.jsx b/client/homebrew/brewRenderer/errorBar/errorBar.jsx index dd5ec5bc29..3a5512ec35 100644 --- a/client/homebrew/brewRenderer/errorBar/errorBar.jsx +++ b/client/homebrew/brewRenderer/errorBar/errorBar.jsx @@ -4,9 +4,12 @@ const createClass = require('create-react-class'); const _ = require('lodash'); const cx = require('classnames'); +const translateOpts = ['htmlError']; + const ErrorBar = createClass({ displayName : 'ErrorBar', getDefaultProps : function() { + ''.setTranslationDefaults(translateOpts); return { errors : [] }; @@ -27,7 +30,7 @@ const ErrorBar = createClass({ if(err.id == 'CLOSE') this.hasCloseError = true; if(err.id == 'MISMATCH') this.hasMatchError = true; return
  • - Line {err.line} : {err.text}, '{err.type}' tag + {'Line'.translate()} {err.line} : {err.text}, '{err.type}' {'tag'.translate()}
  • ; }); @@ -38,23 +41,23 @@ const ErrorBar = createClass({ const msg = []; if(this.hasOpenError){ msg.push(
    - An unmatched opening tag means there's an opened tag that isn't closed. You need to close your tags, like this {'
    '}. Make sure to match types! + {'openTag'.translate()} ); } if(this.hasCloseError){ msg.push(
    - An unmatched closing tag means you closed a tag without opening it. Either remove it, or check to where you think you opened it. + {'closeTag'.translate()}
    ); } if(this.hasMatchError){ msg.push(
    - A type mismatch means you closed a tag, but the last open tag was a different type. + {'missmatchTag'.translate()}
    ); } return
    -

    Protips!

    +

    {'Protips!'.translate()}

    {msg}
    ; }, @@ -64,8 +67,8 @@ const ErrorBar = createClass({ return
    -

    There are HTML errors in your markup

    - If these aren't fixed your brew will not render properly when you print it to PDF or share it +

    {'h3Title'.translate()}

    + {'descriptionText'.translate()} {this.renderErrors()}
    {this.renderProtip()} diff --git a/client/homebrew/brewRenderer/notificationPopup/notificationPopup.jsx b/client/homebrew/brewRenderer/notificationPopup/notificationPopup.jsx index 3c706d6f76..bf073174e5 100644 --- a/client/homebrew/brewRenderer/notificationPopup/notificationPopup.jsx +++ b/client/homebrew/brewRenderer/notificationPopup/notificationPopup.jsx @@ -5,10 +5,12 @@ const _ = require('lodash'); const cx = require('classnames'); //Unused variable const DISMISS_KEY = 'dismiss_notification12-04-23'; +const translateOpts = ['notificationPopup']; const NotificationPopup = createClass({ displayName : 'NotificationPopup', getInitialState : function() { + ''.setTranslationDefaults(translateOpts); return { notifications : {} }; @@ -21,6 +23,7 @@ const NotificationPopup = createClass({ window.removeEventListener('resize', this.checkNotifications); }, notifications : { + // as the following is a text that is supposed to recieve updates usually, we will keep it untranslated by now. psa : function(){ return ( <> @@ -73,8 +76,8 @@ const NotificationPopup = createClass({
    -

    Notice

    - This website is always improving and we are still adding new features and squashing bugs. Keep the following in mind: +

    {'Notice'.translate()}

    + {'keepInMind'.translate()}
      {_.values(this.state.notifications)}
    ; From cdaccdc30407f4e50e3060da04bc05b85cab9348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 23:07:41 +0100 Subject: [PATCH 22/58] navigation update --- client/homebrew/navbar/metadata.navitem.jsx | 18 +++++++++--------- client/homebrew/navbar/patreon.navitem.jsx | 2 +- client/homebrew/navbar/print.navitem.jsx | 2 +- client/homebrew/navbar/reddit.navitem.jsx | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/homebrew/navbar/metadata.navitem.jsx b/client/homebrew/navbar/metadata.navitem.jsx index e0c8a16b81..c865cf0956 100644 --- a/client/homebrew/navbar/metadata.navitem.jsx +++ b/client/homebrew/navbar/metadata.navitem.jsx @@ -30,7 +30,7 @@ const MetadataNav = createClass({ }, getAuthors : function(){ - if(!this.props.brew.authors || this.props.brew.authors.length == 0) return 'noAuthors'.translate(); + if(!this.props.brew.authors || this.props.brew.authors.length == 0) return 'no authors'.translate(); return <> {this.props.brew.authors.map((author, idx, arr)=>{ const spacer = arr.length - 1 == idx ? <> : , ; @@ -40,7 +40,7 @@ const MetadataNav = createClass({ }, getTags : function(){ - if(!this.props.brew.tags || this.props.brew.tags.length == 0) return 'noTags'.translate(); + if(!this.props.brew.tags || this.props.brew.tags.length == 0) return 'no tags'.translate(); return <> {this.props.brew.tags.map((tag, idx)=>{ return {tag}; @@ -49,30 +49,30 @@ const MetadataNav = createClass({ }, getSystems : function(){ - if(!this.props.brew.systems || this.props.brew.systems.length == 0) return 'noSystems'.translate(); + if(!this.props.brew.systems || this.props.brew.systems.length == 0) return 'no systems'.translate(); return this.props.brew.systems.join(', '); }, renderMetaWindow : function(){ return
    -

    {'description'.translate()}

    -

    {this.props.brew.description || 'noDescription'.translate()}

    +

    {'Description'.translate()}

    +

    {this.props.brew.description || 'No description.'.translate()}

    -

    {'authors'.translate()}

    +

    {'Authors'.translate()}

    {this.getAuthors()}

    -

    {'tags'.translate()}

    +

    {'Tags'.translate()}

    {this.getTags()}

    -

    {'systems'.translate()}

    +

    {'Systems'.translate()}

    {this.getSystems()}

    -

    {'updated'.translate()}

    +

    {'Updated'.translate()}

    {Moment(this.props.brew.updatedAt).fromNow()}

    ; diff --git a/client/homebrew/navbar/patreon.navitem.jsx b/client/homebrew/navbar/patreon.navitem.jsx index e3efa55faa..e7d11c50cb 100644 --- a/client/homebrew/navbar/patreon.navitem.jsx +++ b/client/homebrew/navbar/patreon.navitem.jsx @@ -11,6 +11,6 @@ module.exports = function(props){ href='https://www.patreon.com/NaturalCrit' color='green' icon='fas fa-heart'> - {'helpOut'.translate()} + {'help out'.translate()}
    ; }; diff --git a/client/homebrew/navbar/print.navitem.jsx b/client/homebrew/navbar/print.navitem.jsx index db58aa7297..892ae8f0f3 100644 --- a/client/homebrew/navbar/print.navitem.jsx +++ b/client/homebrew/navbar/print.navitem.jsx @@ -7,6 +7,6 @@ const translateOpts = ['nav']; module.exports = function(props){ ''.setTranslationDefaults(translateOpts); return - {'getPdf'.translate()} + {'get pdf'.translate()} ; }; diff --git a/client/homebrew/navbar/reddit.navitem.jsx b/client/homebrew/navbar/reddit.navitem.jsx index 3acbc53fab..31877ebd35 100644 --- a/client/homebrew/navbar/reddit.navitem.jsx +++ b/client/homebrew/navbar/reddit.navitem.jsx @@ -40,7 +40,7 @@ const RedditShare = createClass({ render : function(){ ''.setTranslationDefaults(translateOpts); return - {'postToReddit'.translate()} + {'share on Reddit'.translate()} ; }, From 8d9ca4f6f5776a5e40161a10a86437415d7dd2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 23:07:53 +0100 Subject: [PATCH 23/58] yaml update --- locale/base-localization-file.yaml | 188 ++++++++++++++++------------- 1 file changed, 101 insertions(+), 87 deletions(-) diff --git a/locale/base-localization-file.yaml b/locale/base-localization-file.yaml index bb3c433b8b..daa0a2002f 100644 --- a/locale/base-localization-file.yaml +++ b/locale/base-localization-file.yaml @@ -40,14 +40,16 @@ nav: share: view: copy url: - share on reddit: + share on Reddit: get pdf: recentBrewsdropdown: recent brews: edited: + recently edited: viewed: + recently viewed: removeRecents: Remove from Recents @@ -86,55 +88,52 @@ userPage: download: delete: -editorPage: - editorGroup: - toolsGroup: - undo: - redo: - brew editor: - style editor: - properties: - - buttonsGroup: - jump to location in editor: - jump to location in preview: - - brewEditorTab: - brewEditor: - snippetsGroup: - textEditorDropdown: - textEditor: - column break: - new page: - vertical spacing: - wide block: - image: - background image: - page number: - auto-incrementing page number: - link to page: - table of contents: - add comment: - - phbDropdown: - phb: - spell: - spell list: - class feature: - note: - descriptive text box: - monster stat block: - wide monster stat block: - cover page: - artist credit: - - tablesDropdown: - tables: - class table: - half class table: - table: - wide table: - split table: +editPage: + tools: + undo: + redo: + Editor Themes: + Brew Editor: + Style Editor: + Properties: + jump to location in editor: + jump to location in preview: + + brewEditor: + snippetsGroup: + textEditorDropdown: + textEditor: + column break: + new page: + vertical spacing: + wide block: + image: + background image: + page number: + auto-incrementing page number: + link to page: + table of contents: + add comment: + + phbDropdown: + phb: + spell: + spell list: + class feature: + note: + descriptive text box: + monster stat block: + wide monster stat block: + cover page: + artist credit: + + tablesDropdown: + tables: + class table: + half class table: + table: + wide table: + split table: styleEditorTab: snippetsGroup: @@ -151,42 +150,43 @@ editorPage: inkFriendly: propertiesTab: - properties: - brewGroup: - brew: - title: - description: - thumbnail: - tags: - add tag: - systems: - 5e: - 4e: - 3.5e: - pathfinder: - renderer: - legacy: - v3: - legacyDemoLink: click here to see the demo page for the old legacy renderer! - - authorsGroup: - authors: - none: - invitedAuthors: - inviteAuthor: - invitedMsg1: invited authors are case sensitive. - invitedMsg2: after adding an invited author, send them the edit link. there, they can choose to accept or decline the invitation. - - privacyGroup: - privacy: - publish: - publishedMsg: published homebrews will be publicly viewable and searchable (eventually...) - delete: - delete brew: - - rendererGroup: - legacy: - v3: + brew: + title: + description: + thumbnail: + tags: + add tag: + systems: + 5e: + 4e: + 3.5e: + pathfinder: + language: + languageSub: Sets the HTML Lang property for your brew. May affect hyphenation or spellcheck. + theme: + renderer: + Legacy: + v3: + legacyDemoLink: click here to see the demo page for the old legacy renderer! + + authors: Authors + None.: + invited authors: + invite author: + invitedSub1: Invited authors are case sensitive. + invitedSub2: After adding an invited author, send them the edit link. there, they can choose to accept or decline the invitation. + + privacy: + publish: + unpublish: + publishedSub: published homebrews will be publicly viewable and searchable (eventually...) + delete: + delete brew: + onlyAuthorDelete: Are you sure you want to delete this brew? Because you are the only owner of this brew, the document will be deleted permanently + confirm1: Are you REALLY sure? You will not be able to recover the document. + multipleAuthorDelete: Are you sure you want to remove this brew from your collection? This will remove you as an editor, but other owners will still be able to access the document. + confirm2: Are you REALLY sure? You will lose editor access to this document. + themesLegacy: Themes are not supported in the Legacy Renderer sharePage: metadataWindow: @@ -198,7 +198,7 @@ sharePage: no tags: Description: No description.: - updated: + Updated: sourceDropdown: source: @@ -215,3 +215,17 @@ accountInfoPage: googleInfo: linkedToGoogle: brewsOnGoogleDrive: + +htmlError: + Line: + tag: + openTag: An unmatched opening tag means there's an opened tag that isn't closed. You need to close your tags, like this {''}. Make sure to match types! + closeTag: An unmatched closing tag means you closed a tag without opening it. Either remove it, or check to where you think you opened it. + missmatchTag: A type mismatch means you closed a tag, but the last open tag was a different type. + Protips!: + h3Title: There are HTML errors in your markup + descriptionText: If these aren't fixed your brew will not render properly when you print it to PDF or share it. + +notificationPopup: + Notice: + keepInMind: "This website is always improving and we are still adding new features and squashing bugs. Keep the following in mind:" From 0b9985accac0324ba69072d62cd767505d60f703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Tue, 9 Jan 2024 23:08:09 +0100 Subject: [PATCH 24/58] metadata editor --- .../editor/metadataEditor/metadataEditor.jsx | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/client/homebrew/editor/metadataEditor/metadataEditor.jsx b/client/homebrew/editor/metadataEditor/metadataEditor.jsx index 074879b05d..3195da5dde 100644 --- a/client/homebrew/editor/metadataEditor/metadataEditor.jsx +++ b/client/homebrew/editor/metadataEditor/metadataEditor.jsx @@ -15,6 +15,7 @@ const validations = require('./validations.js'); const SYSTEMS = ['5e', '4e', '3.5e', 'Pathfinder']; const homebreweryThumbnail = require('../../thumbnail.png'); +const translateOpts = ['editPage', 'propertiesTab']; const callIfExists = (val, fn, ...args)=>{ if(val[fn]) { @@ -25,6 +26,7 @@ const callIfExists = (val, fn, ...args)=>{ const MetadataEditor = createClass({ displayName : 'MetadataEditor', getDefaultProps : function() { + ''.setTranslationDefaults(translateOpts); return { metadata : { editId : null, @@ -121,11 +123,11 @@ const MetadataEditor = createClass({ handleDelete : function(){ if(this.props.metadata.authors && this.props.metadata.authors.length <= 1){ - if(!confirm('Are you sure you want to delete this brew? Because you are the only owner of this brew, the document will be deleted permanently.')) return; - if(!confirm('Are you REALLY sure? You will not be able to recover the document.')) return; + if(!confirm('onlyAuthorDelete'.translate())) return; + if(!confirm('confirm1'.translate())) return; } else { - if(!confirm('Are you sure you want to remove this brew from your collection? This will remove you as an editor, but other owners will still be able to access the document.')) return; - if(!confirm('Are you REALLY sure? You will lose editor access to this document.')) return; + if(!confirm('multipleAuthorDelete'.translate())) return; + if(!confirm('confirm2'.translate())) return; } request.delete(`/api/${this.props.metadata.googleId ?? ''}${this.props.metadata.editId}`) @@ -154,11 +156,11 @@ const MetadataEditor = createClass({ renderPublish : function(){ if(this.props.metadata.published){ return ; } else { return ; } }, @@ -167,22 +169,22 @@ const MetadataEditor = createClass({ if(!this.props.metadata.editId) return; return
    - +
    ; }, renderAuthors : function(){ - let text = 'None.'; + let text = 'None.'.translate(); if(this.props.metadata.authors && this.props.metadata.authors.length){ text = this.props.metadata.authors.join(', '); } return
    - +
    {text}
    @@ -212,7 +214,7 @@ const MetadataEditor = createClass({ dropdown =
    - {`Themes are not supported in the Legacy Renderer`} + {'themesLegacy'.translate()}
    ; } else { @@ -227,7 +229,7 @@ const MetadataEditor = createClass({ } return
    - + {dropdown}
    ; }, @@ -248,7 +250,7 @@ const MetadataEditor = createClass({ const debouncedHandleFieldChange = _.debounce(this.handleFieldChange, 500); return
    - +
    - Sets the HTML Lang property for your brew. May affect hyphenation or spellcheck. + {'languageSub'.translate()}
    ; @@ -286,7 +288,7 @@ const MetadataEditor = createClass({ name = 'renderer' checked={this.props.metadata.renderer === 'legacy'} onChange={(e)=>this.handleRenderer('legacy', e)} /> - Legacy + {'Legacy'.translate()} - Click here to see the demo page for the old Legacy renderer! + {'legacyDemoLink'.translate()}
    ; @@ -308,10 +310,10 @@ const MetadataEditor = createClass({ render : function(){ return
    -

    Brew

    +

    {'Brew'.translate()}

    - + this.handleFieldChange('title', e)} /> @@ -319,12 +321,12 @@ const MetadataEditor = createClass({
    - +