Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

128
Visualizações
Setting different values for one exported variable

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.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda