language stuff

This commit is contained in:
Anthony Stirling 2023-08-28 10:17:02 +01:00
parent bc534c12a5
commit 6409274f83
20 changed files with 219 additions and 72 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -1,4 +1,5 @@
<html xmlns:th="http://www.thymeleaf.org">
<!doctype html>
<html th:lang="${#locale.toString()}" th:lang-direction="#{language.direction}" xmlns:th="http://www.thymeleaf.org">
<th:block th:insert="~{fragments/common :: head(title=#{login.title})}"></th:block>
<script src="js/darkmode.js"></script>
@ -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) {
<form th:action="@{login}" method="post">
<img class="mb-4" src="favicon.svg" alt="" width="144" height="144">
<h1 class="h1 mb-3 fw-normal" th:text="${@appName}">Stirling-PDF</h1>
<h2 class="h5 mb-3 fw-normal" th:text="#{login.signin}">Please sign in</h2>
<h2 class="h5 mb-3 fw-normal" th:text="#{login.signinTitle}">Please sign in</h2>
<div class="form-floating">
<input type="text" class="form-control bg-dark text-light" id="username" name="username"