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

286
Vistas
Are text files that are hosted on a server edited locally?

I'm trying to build a website that is bilingual. Originally, I wrote it using nodeJS but then found it difficult/expensive to host because VPS/Dedicated server packages are required to run a nodeJS app. So now, I'm using just plain vanilla javascript and JQuery to translate the page and haven't quite figured out the best way to do so.

HOW THE TRANSLATION WORKS:

There is a button on the page that says "En Español" that has an event listener attached to it. The idea is that once the user clicks it, all the text gets converted to spanish, and that button now reads "In English", incase users want to translate to english. This would work nicely if I had just one html page, but I have four, so I need a way to track the language the user wants. So I thought what if I had a text file or json file that had the language code (i.e., "en" or "es") and when ever the translate button is clicked it changes 'en' to 'es' and vice versa.

So my question is: if i had a text file to contain the language code, and I host it to say hostgator and by default I set it to be "en" -- every time a user clicks on the translate button, will it actually change the file hosted on HostGator, or is there like a local copy that's changed? I don't want a user to click on this button, and then everyone else that is on the webpage suddenly have their site change languages. I'm hoping the text file will always say "en", and only changes locally. Any tips or any better solution for how to make the page bilingual?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You don´t need to change the file in the server. You can have diferent json files with the same keys in the object. Every time the languaje change, you can switch between files.

Ex: en.js

{
  "title": "A title in English",
  "important_par": "this is an important text"
}

es.js

{
  "title": "Titulo en Español",
  "important_par": "Este es un párrafo importante"
}
about 4 years ago · Juan Pablo Isaza Denunciar
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