I want to use different languages for users on my website without using i18n. Currently I am having issues on setting setting one variable with different values coming from two different files. Reason is that exported variable need to be set with a value in the beginning and ideally cannot be changed after. Is there a way to transform it into an conditional variable that can be exported after?
Here is my code example:
english.js (file)
var lang_eng = {
"administration": {
"building": "Administration of Building",
"information": "Inoformation",
"regsiterd_user": "Registered user: ",
"actived_user": "Activated user: ",
"available_rolls": "Available roles: ",
"administrator": "Administrator: "
}
german.js (file)
export var lang_de = {
"user_administration": {
"building": "Administration of Building",
"information": "Inofrmationen",
"regsiterd_user": "Registrierte Benutzer: ",
"actived_user": "Aktivierte Benutzer: ",
"available_rolls": "Verfügbare Rollen: ",
"administrators": "Administratoren: "
}
I want to use the third HTML file to set the different languages in a dropdown Botton
At the moment I can only change the language manually with the third exported variable "languageSelector" which is defined as a Hook that derive the keys from the respective language files in different pages.
export var languageSelector = lang_de for German
or
export languageSelector = lang_eng for English
Do you have any idea on how to use a local Storage for that?
Really thanks al to in advance for your help.