-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors page single with localization (js version) #88
Comments
@peppelinux , I have written a simple demo for a errors page single with localization, is a really simple js. errors.js const localizations = {
'it': {
'100': 'Autenticazione fallita'
},
'en': {
'100': 'Authentication fail'
}
}
document.addEventListener("DOMContentLoaded", () => {
let default_locale = 'it'
let available_locales = ['it','en']
let params = new URLSearchParams(window.location.search)
let locale = available_locales.includes(params.get('locale')) ? params.get('locale') : default_locale ;
let element = document.getElementById('error')
if (localizations[locale][params.get('error')]) {
element.innerHTML = localizations[locale][params.get('error')]
}
}); Without options return the standard error page If I add the Optionally I ca add also the locale option We can also detach the localization from the error.js, in a single locale json or with different json file for each locale. What do you think about it? |
@MdreW very interesting feature I'd like to have it in 2.1.0 together with i18n in pyeudiw if you can go ahead with a PR we'll get it in time, we won't change the templates in this version 2.0.0 |
Ok, I will work for this 👍 |
New proposal for errors page.
Use the same errors page for all errors and add more detail and localization with javascript.
For security reason the errors details can't be add from with a simple string, but must be decoded from the error's code.
With a javascript we read a json with all codes and his error details and add this in the error box.
Vantage:
example json:
The text was updated successfully, but these errors were encountered: