From 6409274f8346b5e37f9e54ab14b28960a7b3013e Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:17:02 +0100 Subject: [PATCH] language stuff --- src/main/resources/messages_ar_AR.properties | 14 +++++++--- src/main/resources/messages_ca_CA.properties | 14 +++++++--- src/main/resources/messages_de_DE.properties | 14 +++++++--- src/main/resources/messages_en_GB.properties | 9 ++++++ src/main/resources/messages_en_US.properties | 14 +++++++--- src/main/resources/messages_es_ES.properties | 14 +++++++--- src/main/resources/messages_eu_ES.properties | 14 +++++++--- src/main/resources/messages_fr_FR.properties | 14 +++++++--- src/main/resources/messages_it_IT.properties | 14 +++++++--- src/main/resources/messages_ja_JP.properties | 14 +++++++--- src/main/resources/messages_ko_KR.properties | 14 +++++++--- src/main/resources/messages_nl_NL.properties | 14 +++++++--- src/main/resources/messages_pl_PL.properties | 14 +++++++--- src/main/resources/messages_pt_BR.properties | 14 +++++++--- src/main/resources/messages_ro_RO.properties | 14 +++++++--- src/main/resources/messages_ru_RU.properties | 14 +++++++--- src/main/resources/messages_sv_SE.properties | 14 +++++++--- src/main/resources/messages_zh_CN.properties | 14 +++++++--- .../resources/static/js/languageSelection.js | 16 +++++++++++ src/main/resources/templates/login.html | 28 ++++++++++++++++--- 20 files changed, 219 insertions(+), 72 deletions(-) diff --git a/src/main/resources/messages_ar_AR.properties b/src/main/resources/messages_ar_AR.properties index 9d6a0a717..290cec4ce 100644 --- a/src/main/resources/messages_ar_AR.properties +++ b/src/main/resources/messages_ar_AR.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_ca_CA.properties b/src/main/resources/messages_ca_CA.properties index 99725d389..99075d553 100644 --- a/src/main/resources/messages_ca_CA.properties +++ b/src/main/resources/messages_ca_CA.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_de_DE.properties b/src/main/resources/messages_de_DE.properties index e1e316328..43c24f654 100644 --- a/src/main/resources/messages_de_DE.properties +++ b/src/main/resources/messages_de_DE.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index d1abe2d4c..05a4bd912 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -308,6 +308,15 @@ showJS.tags=Redact,Hide,black out,black,marker,hidden # WEB PAGES # # # ########################### +#login +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + #auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact diff --git a/src/main/resources/messages_en_US.properties b/src/main/resources/messages_en_US.properties index 96f082fff..dc7c93f8c 100644 --- a/src/main/resources/messages_en_US.properties +++ b/src/main/resources/messages_en_US.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_es_ES.properties b/src/main/resources/messages_es_ES.properties index 73e2c53ea..8ece9c785 100644 --- a/src/main/resources/messages_es_ES.properties +++ b/src/main/resources/messages_es_ES.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_eu_ES.properties b/src/main/resources/messages_eu_ES.properties index 554bfad2b..75edb5a4d 100644 --- a/src/main/resources/messages_eu_ES.properties +++ b/src/main/resources/messages_eu_ES.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_fr_FR.properties b/src/main/resources/messages_fr_FR.properties index 1f3bcc2ca..dad357130 100644 --- a/src/main/resources/messages_fr_FR.properties +++ b/src/main/resources/messages_fr_FR.properties @@ -299,9 +299,6 @@ home.showJS.title=Afficher le JavaScript home.showJS.desc=Recherche et affiche tout JavaScript injecté dans un PDF. showJS.tags=afficher,javascript,js -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=afficher,javascript,js @@ -311,10 +308,19 @@ showJS.tags=afficher,javascript,js # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_it_IT.properties b/src/main/resources/messages_it_IT.properties index aed51bb06..0f150f8ca 100644 --- a/src/main/resources/messages_it_IT.properties +++ b/src/main/resources/messages_it_IT.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_ja_JP.properties b/src/main/resources/messages_ja_JP.properties index b9e2506ac..46a45d482 100644 --- a/src/main/resources/messages_ja_JP.properties +++ b/src/main/resources/messages_ja_JP.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_ko_KR.properties b/src/main/resources/messages_ko_KR.properties index 5b5fbd489..50a8a7d00 100644 --- a/src/main/resources/messages_ko_KR.properties +++ b/src/main/resources/messages_ko_KR.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_nl_NL.properties b/src/main/resources/messages_nl_NL.properties index e3953ed33..331ecd891 100644 --- a/src/main/resources/messages_nl_NL.properties +++ b/src/main/resources/messages_nl_NL.properties @@ -299,9 +299,6 @@ home.showJS.title=Toon Javascript home.showJS.desc=Zoekt en toont ieder script dat in een PDF is geïnjecteerd showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_pl_PL.properties b/src/main/resources/messages_pl_PL.properties index 7cd0d36ca..bac7aa5f9 100644 --- a/src/main/resources/messages_pl_PL.properties +++ b/src/main/resources/messages_pl_PL.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_pt_BR.properties b/src/main/resources/messages_pt_BR.properties index c9b1807d9..3a89624e4 100644 --- a/src/main/resources/messages_pt_BR.properties +++ b/src/main/resources/messages_pt_BR.properties @@ -299,9 +299,6 @@ home.showJS.title=Mostrar Javascript home.showJS.desc=Procura e exibe qualquer JavaScript injetado em um PDF showJS.tags=JavaScript -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JavaScript @@ -311,10 +308,19 @@ showJS.tags=JavaScript # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_ro_RO.properties b/src/main/resources/messages_ro_RO.properties index 9a49a2ffe..bc038897f 100644 --- a/src/main/resources/messages_ro_RO.properties +++ b/src/main/resources/messages_ro_RO.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_ru_RU.properties b/src/main/resources/messages_ru_RU.properties index 869a74b8f..7e4121ee9 100644 --- a/src/main/resources/messages_ru_RU.properties +++ b/src/main/resources/messages_ru_RU.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_sv_SE.properties b/src/main/resources/messages_sv_SE.properties index 769c3d9b6..139c9ca23 100644 --- a/src/main/resources/messages_sv_SE.properties +++ b/src/main/resources/messages_sv_SE.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/messages_zh_CN.properties b/src/main/resources/messages_zh_CN.properties index 6cb2ef352..3bfdab32a 100644 --- a/src/main/resources/messages_zh_CN.properties +++ b/src/main/resources/messages_zh_CN.properties @@ -299,9 +299,6 @@ home.showJS.title=Show Javascript home.showJS.desc=Searches and displays any JS injected into a PDF showJS.tags=JS -########################## -### TODO: Translate ### -########################## home.autoRedact.title=Auto Redact home.autoRedact.desc=Auto Redacts(Blacks out) text in a PDF based on input text showJS.tags=JS @@ -311,10 +308,19 @@ showJS.tags=JS # WEB PAGES # # # ########################### -#auto-redact +#login ########################## ### TODO: Translate ### ########################## +login.title=Sign in +login.signin=Sign in +login.rememberme=Remember me +login.invalid=Invalid username or password. +login.locked=Your account has been locked. +login.signinTitle=Please sign in + + +#auto-redact autoRedact.title=Auto Redact autoRedact.header=Auto Redact autoRedact.textsToRedactLabel=Text to Redact (line-separated) diff --git a/src/main/resources/static/js/languageSelection.js b/src/main/resources/static/js/languageSelection.js index 3da819b3d..c554c2a7a 100644 --- a/src/main/resources/static/js/languageSelection.js +++ b/src/main/resources/static/js/languageSelection.js @@ -1,4 +1,5 @@ document.addEventListener('DOMContentLoaded', function() { + setLanguageForDropdown('.lang_dropdown-item'); const defaultLocale = document.documentElement.lang || 'en_GB'; const storedLocale = localStorage.getItem('languageCode') || defaultLocale; const dropdownItems = document.querySelectorAll('.lang_dropdown-item'); @@ -13,6 +14,21 @@ document.addEventListener('DOMContentLoaded', function() { } }); +function setLanguageForDropdown(dropdownClass) { + const defaultLocale = document.documentElement.lang || 'en_GB'; + const storedLocale = localStorage.getItem('languageCode') || defaultLocale; + const dropdownItems = document.querySelectorAll(dropdownClass); + + for (let i = 0; i < dropdownItems.length; i++) { + const item = dropdownItems[i]; + item.classList.remove('active'); + if (item.dataset.languageCode === storedLocale) { + item.classList.add('active'); + } + item.addEventListener('click', handleDropdownItemClick); + } +} + function handleDropdownItemClick(event) { event.preventDefault(); const languageCode = event.currentTarget.dataset.bsLanguageCode; // change this to event.currentTarget diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index 7a9f4aa0f..1ddea6ec6 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -1,4 +1,5 @@ - + + @@ -170,9 +171,28 @@ document.addEventListener('modeChanged', function(e) { }); document.addEventListener('DOMContentLoaded', function() { - const dropdown = document.getElementById('languageDropdown'); - const defaultLocale = document.documentElement.lang || 'en_GB'; + + const defaultLocale = document.documentElement.lang || 'en_GB'; const storedLocale = localStorage.getItem('languageCode') || defaultLocale; + + const currentURL = new URL(window.location.href); + const urlParams = currentURL.searchParams; + const currentLangParam = urlParams.get('lang') || defaultLocale; + + console.log("defaultLocale", defaultLocale) + console.log("storedLocale", storedLocale) + console.log("currentLangParam", currentLangParam) + + if (currentLangParam !== storedLocale) { + urlParams.set('lang', storedLocale); + currentURL.search = urlParams.toString(); + + console.log("redirecting to", currentURL.toString()); + window.location.href = currentURL.toString(); + return; + } + + const dropdown = document.getElementById('languageDropdown'); const dropdownItems = document.querySelectorAll('.lang_dropdown-item'); let activeItem; @@ -241,7 +261,7 @@ function handleDropdownItemClick(event) {

Stirling-PDF

-

Please sign in

+

Please sign in