i18next integration for Nightscout #4209
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FIRST ATTEMPT, NOT READY, PROOF OF CONCEPT ONLY
@sulkaharo @jpcunningh @MilosKozak @jasoncalabrese
I did a first attempt of integration of i18next for being able to generate translations from source to json files, that can be loaded on runtime. Advantages:
With
npm run translations-scanner
the JSON-files per languages instatic/tranlsations
will be updated based on the source inlib
. I started with temporary code to convert the translations fromlanguage.js
to json files that can be loaded on runtime.This branch is not ready! I got stuck on the integration. I'm quite busy the next days and hope to have time on sunday to work further on this, so I would like to have your opinion.
Questions:
i18next
at runtime for nowlanguage.js
. I noticed theBASE_URL
environment is not used anymore and not available anymore. Should we use aset(newlang, url)
so that the caller should provide the url where the language translations are located, or is there a cleaner way.d3
translations (see https://github.com/d3/d3-geo/blob/master/README.md#projection_translate ) likereturn 'translate(
inlib/client/renderer.js
(e.g. inrectTranslate
function) causes language translations like:perhaps we should rename non d3 translations to
t
, or directly start usingi18next.t(key, options)