Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

125
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda