From 4c4925662497b91bc9a62c17a4f17c876665a7c6 Mon Sep 17 00:00:00 2001 From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com> Date: Wed, 13 Apr 2022 06:46:00 +0200 Subject: [PATCH] Translate Websites Page and fix loading theme and language --- qortal-ui-core/language/cn.json | 37 +++++ qortal-ui-core/language/de.json | 37 +++++ qortal-ui-core/language/fr.json | 37 +++++ qortal-ui-core/language/pl.json | 37 +++++ qortal-ui-core/language/sp.json | 37 +++++ qortal-ui-core/language/us.json | 37 +++++ .../plugins/core/minting/minting-info.src.js | 25 +-- .../name-registration.src.js | 58 +++---- .../plugins/core/qdn/websites.src.js | 142 +++++++++++------- .../core/reward-share/reward-share.src.js | 31 ++-- .../core/trade-portal/trade-portal.src.js | 42 +++--- .../plugins/core/wallet/wallet-app.src.js | 25 +-- 12 files changed, 410 insertions(+), 135 deletions(-) diff --git a/qortal-ui-core/language/cn.json b/qortal-ui-core/language/cn.json index 0deea356..d907364b 100644 --- a/qortal-ui-core/language/cn.json +++ b/qortal-ui-core/language/cn.json @@ -283,5 +283,42 @@ "nchange16": "Need Core Update", "nchange17": "Name Already Exists!", "nchange18": "Name Registration Successful!" + }, + "websitespage": { + "schange1": "Browse Websites", + "schange2": "Followed Websites", + "schange3": "Blocked Websites", + "schange4": "Search Websites", + "schange5": "Avatar", + "schange6": "Details", + "schange7": "Published by", + "schange8": "Actions", + "schange9": "Websites", + "schange10": "No websites available", + "schange11": "Your Followed Websites", + "schange12": "Followed Websites", + "schange13": "You aren't following any websites", + "schange14": "Your Blocked Websites", + "schange15": "Blocked Websites", + "schange16": "You have not blocked any websites", + "schange17": "Name Not Found!", + "schange18": "Relay mode is enabled. This means that your node will help to transport encrypted data around the network when a peer requests it. You can opt out by setting", + "schange19": "in", + "schange20": "Relay mode is disabled. You can enable it by setting", + "schange21": "Publish Website", + "schange22": "Error occurred when trying to follow this registered name. Please try again!", + "schange23": "Error occurred when trying to unfollow this registered name. Please try again!", + "schange24": "Error occurred when trying to block this registered name. Please try again!", + "schange25": "Error occurred when trying to unblock this registered name. Please try again!", + "schange26": "Uncategorized", + "schange27": "Size", + "schange28": "Status", + "schange29": "Follow", + "schange30": "Unfollow", + "schange31": "Block", + "schange32": "Unblock", + "schange33": "Name to search", + "schange34": "Name can not be empty!", + "schange35": "Search" } } \ No newline at end of file diff --git a/qortal-ui-core/language/de.json b/qortal-ui-core/language/de.json index bfc8f665..2963f779 100644 --- a/qortal-ui-core/language/de.json +++ b/qortal-ui-core/language/de.json @@ -283,5 +283,42 @@ "nchange16": "Core-Update erforderlich", "nchange17": "Name existiert bereits!", "nchange18": "Namensregistrierung erfolgreich!" + }, + "websitespage": { + "schange1": "Webseiten durchsuchen", + "schange2": "Gefolgte Webseiten", + "schange3": "Blockierte Webseiten", + "schange4": "Suche Webseite", + "schange5": "Avatar", + "schange6": "Einzelheiten", + "schange7": "Herausgegeben von", + "schange8": "Aktionen", + "schange9": "Webseiten", + "schange10": "Keine Webseiten verfügbar", + "schange11": "Ihre verfolgten Webseiten", + "schange12": "Gefolgte Websites", + "schange13": "Du folgst keine Webseiten", + "schange14": "Ihre blockierten Webseiten", + "schange15": "Blockierte Webseiten", + "schange16": "Sie haben keine Webseiten blockiert", + "schange17": "Name nicht gefunden!", + "schange18": "Der Relay-Modus ist aktiviert. Dies bedeutet, dass Ihr Knoten dabei hilft, verschlüsselte Daten im Netzwerk zu transportieren, wenn ein Peer sie anfordert. Sie können sich per Einstellung abmelden, ändern Sie", + "schange19": "in", + "schange20": "Der Relay-Modus ist deaktiviert. Sie können es durch Einstellung aktivieren, ändern Sie", + "schange21": "Webseite veröffentlichen", + "schange22": "Beim Versuch, diesem registrierten Namen zu folgen, ist ein Fehler aufgetreten. Bitte versuche es erneut!", + "schange23": "Beim Versuch, diesem registrierten Namen nicht mehr zu folgen, ist ein Fehler aufgetreten. Bitte versuche es erneut!", + "schange24": "Beim Blockieren dieses registrierten Namens ist ein Fehler aufgetreten. Bitte versuche es erneut!", + "schange25": "Beim Versuch, diesen registrierten Namen zu entsperren, ist ein Fehler aufgetreten. Bitte versuche es erneut!", + "schange26": "Nicht kategorisiert", + "schange27": "Größe", + "schange28": "Status", + "schange29": "Folgen", + "schange30": "Entfolgen", + "schange31": "Sperren", + "schange32": "Entsperren", + "schange33": "Name zu suchen", + "schange34": "Name darf nicht leer sein!", + "schange35": "Suchen" } } \ No newline at end of file diff --git a/qortal-ui-core/language/fr.json b/qortal-ui-core/language/fr.json index ee4c99e8..979654c2 100644 --- a/qortal-ui-core/language/fr.json +++ b/qortal-ui-core/language/fr.json @@ -283,5 +283,42 @@ "nchange16": "Need Core Update", "nchange17": "Name Already Exists!", "nchange18": "Name Registration Successful!" + }, + "websitespage": { + "schange1": "Browse Websites", + "schange2": "Followed Websites", + "schange3": "Blocked Websites", + "schange4": "Search Websites", + "schange5": "Avatar", + "schange6": "Details", + "schange7": "Published by", + "schange8": "Actions", + "schange9": "Websites", + "schange10": "No websites available", + "schange11": "Your Followed Websites", + "schange12": "Followed Websites", + "schange13": "You aren't following any websites", + "schange14": "Your Blocked Websites", + "schange15": "Blocked Websites", + "schange16": "You have not blocked any websites", + "schange17": "Name Not Found!", + "schange18": "Relay mode is enabled. This means that your node will help to transport encrypted data around the network when a peer requests it. You can opt out by setting", + "schange19": "in", + "schange20": "Relay mode is disabled. You can enable it by setting", + "schange21": "Publish Website", + "schange22": "Error occurred when trying to follow this registered name. Please try again!", + "schange23": "Error occurred when trying to unfollow this registered name. Please try again!", + "schange24": "Error occurred when trying to block this registered name. Please try again!", + "schange25": "Error occurred when trying to unblock this registered name. Please try again!", + "schange26": "Uncategorized", + "schange27": "Size", + "schange28": "Status", + "schange29": "Follow", + "schange30": "Unfollow", + "schange31": "Block", + "schange32": "Unblock", + "schange33": "Name to search", + "schange34": "Name can not be empty!", + "schange35": "Search" } } \ No newline at end of file diff --git a/qortal-ui-core/language/pl.json b/qortal-ui-core/language/pl.json index 0f76a6d7..9225c23b 100644 --- a/qortal-ui-core/language/pl.json +++ b/qortal-ui-core/language/pl.json @@ -283,5 +283,42 @@ "nchange16": "Need Core Update", "nchange17": "Name Already Exists!", "nchange18": "Name Registration Successful!" + }, +, + "websitespage": { + "schange1": "Browse Websites", + "schange2": "Followed Websites", + "schange3": "Blocked Websites", + "schange4": "Search Websites", + "schange5": "Avatar", + "schange6": "Details", + "schange7": "Published by", + "schange8": "Actions", + "schange9": "Websites", + "schange10": "No websites available", + "schange11": "Your Followed Websites", + "schange12": "Followed Websites", + "schange13": "You aren't following any websites", + "schange14": "Your Blocked Websites", + "schange15": "Blocked Websites", + "schange16": "You have not blocked any websites", + "schange17": "Name Not Found!", + "schange18": "Relay mode is enabled. This means that your node will help to transport encrypted data around the network when a peer requests it. You can opt out by setting", + "schange19": "in", + "schange20": "Relay mode is disabled. You can enable it by setting", + "schange21": "Publish Website", + "schange22": "Error occurred when trying to follow this registered name. Please try again!", + "schange23": "Error occurred when trying to unfollow this registered name. Please try again!", + "schange24": "Error occurred when trying to block this registered name. Please try again!", + "schange25": "Error occurred when trying to unblock this registered name. Please try again!", + "schange26": "Uncategorized", + "schange27": "Size", + "schange28": "Status", + "schange29": "Follow", + "schange30": "Unfollow", + "schange31": "Block", + "schange32": "Unblock", + "schange33": "Name to search", + "schange35": "Search" } } diff --git a/qortal-ui-core/language/sp.json b/qortal-ui-core/language/sp.json index a0ff1f28..e1b1e07e 100644 --- a/qortal-ui-core/language/sp.json +++ b/qortal-ui-core/language/sp.json @@ -283,5 +283,42 @@ "nchange16": "Need Core Update", "nchange17": "Name Already Exists!", "nchange18": "Name Registration Successful!" + }, + "websitespage": { + "schange1": "Browse Websites", + "schange2": "Followed Websites", + "schange3": "Blocked Websites", + "schange4": "Search Websites", + "schange5": "Avatar", + "schange6": "Details", + "schange7": "Published by", + "schange8": "Actions", + "schange9": "Websites", + "schange10": "No websites available", + "schange11": "Your Followed Websites", + "schange12": "Followed Websites", + "schange13": "You aren't following any websites", + "schange14": "Your Blocked Websites", + "schange15": "Blocked Websites", + "schange16": "You have not blocked any websites", + "schange17": "Name Not Found!", + "schange18": "Relay mode is enabled. This means that your node will help to transport encrypted data around the network when a peer requests it. You can opt out by setting", + "schange19": "in", + "schange20": "Relay mode is disabled. You can enable it by setting", + "schange21": "Publish Website", + "schange22": "Error occurred when trying to follow this registered name. Please try again!", + "schange23": "Error occurred when trying to unfollow this registered name. Please try again!", + "schange24": "Error occurred when trying to block this registered name. Please try again!", + "schange25": "Error occurred when trying to unblock this registered name. Please try again!", + "schange26": "Uncategorized", + "schange27": "Size", + "schange28": "Status", + "schange29": "Follow", + "schange30": "Unfollow", + "schange31": "Block", + "schange32": "Unblock", + "schange33": "Name to search", + "schange34": "Name can not be empty!", + "schange35": "Search" } } \ No newline at end of file diff --git a/qortal-ui-core/language/us.json b/qortal-ui-core/language/us.json index fe0c2d4d..cbb98950 100644 --- a/qortal-ui-core/language/us.json +++ b/qortal-ui-core/language/us.json @@ -283,5 +283,42 @@ "nchange16": "Need Core Update", "nchange17": "Name Already Exists!", "nchange18": "Name Registration Successful!" + }, + "websitespage": { + "schange1": "Browse Websites", + "schange2": "Followed Websites", + "schange3": "Blocked Websites", + "schange4": "Search Websites", + "schange5": "Avatar", + "schange6": "Details", + "schange7": "Published by", + "schange8": "Actions", + "schange9": "Websites", + "schange10": "No websites available", + "schange11": "Your Followed Websites", + "schange12": "Followed Websites", + "schange13": "You aren't following any websites", + "schange14": "Your Blocked Websites", + "schange15": "Blocked Websites", + "schange16": "You have not blocked any websites", + "schange17": "Name Not Found!", + "schange18": "Relay mode is enabled. This means that your node will help to transport encrypted data around the network when a peer requests it. You can opt out by setting", + "schange19": "in", + "schange20": "Relay mode is disabled. You can enable it by setting", + "schange21": "Publish Website", + "schange22": "Error occurred when trying to follow this registered name. Please try again!", + "schange23": "Error occurred when trying to unfollow this registered name. Please try again!", + "schange24": "Error occurred when trying to block this registered name. Please try again!", + "schange25": "Error occurred when trying to unblock this registered name. Please try again!", + "schange26": "Uncategorized", + "schange27": "Size", + "schange28": "Status", + "schange29": "Follow", + "schange30": "Unfollow", + "schange31": "Block", + "schange32": "Unblock", + "schange33": "Name to search", + "schange34": "Name can not be empty!", + "schange35": "Search" } } \ No newline at end of file diff --git a/qortal-ui-plugins/plugins/core/minting/minting-info.src.js b/qortal-ui-plugins/plugins/core/minting/minting-info.src.js index 8b945e5e..bd45a6d0 100644 --- a/qortal-ui-plugins/plugins/core/minting/minting-info.src.js +++ b/qortal-ui-plugins/plugins/core/minting/minting-info.src.js @@ -1,7 +1,7 @@ import { LitElement, html, css } from 'lit' import { render } from 'lit/html.js' import { Epml } from '../../../epml.js' -import { use, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' registerTranslateConfig({ loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) @@ -362,17 +362,8 @@ class MintingInfo extends LitElement { firstUpdated() { this.changeTheme() - - setInterval(() => { - this.changeTheme() - }, 100) - this.changeLanguage() - setInterval(() => { - this.changeLanguage() - }, 100) - const getAdminInfo = () => { parentEpml.request("apiCall", { url: `/admin/info` }).then((res) => { setTimeout(() => { this.adminInfo = res; }, 1); @@ -410,6 +401,20 @@ class MintingInfo extends LitElement { setTimeout(getAddressLevel, 30000); }; + window.addEventListener('storage', () => { + const checkLanguage = localStorage.getItem('qortalLanguage') + const checkTheme = localStorage.getItem('qortalTheme') + + use(checkLanguage) + + if (checkTheme === 'dark') { + this.theme = 'dark' + } else { + this.theme = 'light' + } + document.querySelector('html').setAttribute('theme', this.theme) + }) + let configLoaded = false; parentEpml.ready().then(() => { diff --git a/qortal-ui-plugins/plugins/core/name-registration/name-registration.src.js b/qortal-ui-plugins/plugins/core/name-registration/name-registration.src.js index b1faa934..dfb98b48 100644 --- a/qortal-ui-plugins/plugins/core/name-registration/name-registration.src.js +++ b/qortal-ui-plugins/plugins/core/name-registration/name-registration.src.js @@ -1,7 +1,7 @@ import { LitElement, html, css } from 'lit' import { render } from 'lit/html.js' import { Epml } from '../../../epml.js' -import { use, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' registerTranslateConfig({ loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) @@ -168,33 +168,8 @@ class NameRegistration extends LitElement { firstUpdated() { this.changeTheme() - - setInterval(() => { - this.changeTheme(); - }, 100) - this.changeLanguage() - - setInterval(() => { - this.changeLanguage() - }, 100) - - this.unitFee(); - - window.addEventListener("contextmenu", (event) => { - event.preventDefault(); - this._textMenu(event) - }); - - window.addEventListener("click", () => { - parentEpml.request('closeCopyTextMenu', null) - }); - - window.onkeyup = (e) => { - if (e.keyCode === 27) { - parentEpml.request('closeCopyTextMenu', null) - } - } + this.unitFee() const fetchNames = () => { parentEpml.request('apiCall', { @@ -205,6 +180,35 @@ class NameRegistration extends LitElement { setTimeout(fetchNames, this.config.user.nodeSettings.pingInterval) } + window.addEventListener("contextmenu", (event) => { + event.preventDefault() + this._textMenu(event) + }) + + window.addEventListener("click", () => { + parentEpml.request('closeCopyTextMenu', null) + }) + + window.addEventListener('storage', () => { + const checkLanguage = localStorage.getItem('qortalLanguage') + const checkTheme = localStorage.getItem('qortalTheme') + + use(checkLanguage) + + if (checkTheme === 'dark') { + this.theme = 'dark' + } else { + this.theme = 'light' + } + document.querySelector('html').setAttribute('theme', this.theme) + }) + + window.onkeyup = (e) => { + if (e.keyCode === 27) { + parentEpml.request('closeCopyTextMenu', null) + } + } + let configLoaded = false parentEpml.ready().then(() => { diff --git a/qortal-ui-plugins/plugins/core/qdn/websites.src.js b/qortal-ui-plugins/plugins/core/qdn/websites.src.js index 895afab7..2bc6056d 100644 --- a/qortal-ui-plugins/plugins/core/qdn/websites.src.js +++ b/qortal-ui-plugins/plugins/core/qdn/websites.src.js @@ -1,18 +1,23 @@ import { LitElement, html, css } from 'lit' import { render } from 'lit/html.js' import { Epml } from '../../../epml.js' +import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' + +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) import '@material/mwc-icon' import '@material/mwc-button' import '@material/mwc-tab-bar' import '@material/mwc-textfield' + import '@vaadin/button' import '@vaadin/grid' import '@vaadin/icon' import '@vaadin/icons' import '@vaadin/text-field' - const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class Websites extends LitElement { @@ -234,41 +239,41 @@ class Websites extends LitElement { return html`