Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Translate various dynamic strings (eg. map legend) #46

Open
laurentS opened this issue Mar 30, 2021 · 0 comments
Open

Translate various dynamic strings (eg. map legend) #46

laurentS opened this issue Mar 30, 2021 · 0 comments

Comments

@laurentS
Copy link
Member

@jhenshall Here are a couple of ideas we could use for things like the legend on the map:

  • Create one version of the script per language, the same way we do for the page content. Pros: structure of the build code is ready, just add more pages. Cons: this prevents user browsers from caching the files and we end up with N copies of almost the same file, which is a bit of a waste. Also, the i18n code probably relies on html tags to work, so it may not actually work in the js content.
  • Have the code load the translated strings from a specific translations file. Efficient, but you need to figure out the deployment logic to generate that translation file, and ideally limit it to the useful content, to avoid having everything loaded twice in the browser.
  • Hard code the strings in a hidden part of the page during the gulp build and then have the dynamic code pull it at run time (with something like a jquery selector). My guess is that this is the easiest, you just add a hidden div at the bottom of the relevant page(s) with an html tag for each string to translate like the rest of the code (so no new deployment logic to invent), then just change the js code above to pull the relevant string from the hidden part of the page.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant