-
Notifications
You must be signed in to change notification settings - Fork 24
Working with I18N
We use react-i18n
to handle text translation is the application.
Locale files are under the directory src/locales
.
dev.json
is the only file you should modify.
When you dev you have to add your keys in it, and that's all.
If you forgot to add your keys, you can run npm run translations-scan
.
This will add all the missing keys in the dev.json
NOTE: In dev mode, the "Dev langage" is available in the lang selector.
We use weblate to manage the tanslation of Gephi-lite : https://hosted.weblate.org/projects/gephi/gephi-lite
Weblate has a direct access to the repository, and when a new key is added to the dev.json
file, it will discovered.
If a translation is added or changed on the weblate interface, you have to commit it on the weblate interface, and then to push it.
This will create a commit on the weblate-i18n
branch of gephi-lite
and create a pull request.
Weblate only modify local files (ie. not the dev.json
), so we should not have conflict on this branch.
Weblate is using git with the code source of the project :
$> git remote add weblate https://hosted.weblate.org/git/gephi/gephi-lite/
$> git remote update weblate
$> git switch -c weblate-dev weblate/dev
(Dev) -[UPDATE]-> (`src/locale/dev.json`) <-[READ]- (Weblate) -[WRITE]-> (`src/locale/{locale}.json`)
- Weblate rebase its
dev
branch with thedev
one of the project. - We you do modification on the interface, weblate commit to its
dev
branch - Every day, if there is an update, weblate push into
weblate-i18n
on github, and do a PR
On weblate, a user can create a new locale and work on the translation, and then a new locale file in the project will be available.
To enable this new locale in the application you have to define it in the file https://github.com/gephi/gephi-lite/blob/dev/src/locales/locales.ts
- Add locally the dev branch of weblate (see the
Git weblate
section) - Update the branch :
(weblate-dev $)> git pull
- Go on the dev branch :
(weblate-dev $)> git checkout dev
- Rebase the
weblate-dev
branch into thedev
one :git rebase weblate-dev
That's all folks.
The en
language is very often just a copy of the dev language which is prefilled with english language.
Thus Weblate throws lot of warning for same translations
.
To remove those warning in bulk:
- go to bulk action page in the english language https://hosted.weblate.org/projects/gephi/gephi-lite/en/#bulk-edit
- filter on: check:same
- apply tag : ignore-same