Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!