Closed Serhioromano closed 2 years ago
Currently there are unit tests that scan .ts .tsx files and take the strings in t('') and check them against translation.json. If there unknown keys the tests fail
That is cool. Can we add sync too? So that we use translation.json
as a source to sync all other locale files?
We already have Crowdin, and we upload translation.json
to auto translate. https://github.com/pancakeswap/pancake-frontend/pull/2730
Generally we don't edit {locale}.json
directly, sometimes auto translation without context cause problem. so updating {locale}.json
is fine, but we have to inform Crowdin folks to know about it
We also have a doc about [i18n](https://github.com/pancakeswap/pancake-frontend/blob/develop/doc/i18n.md. It is lacking some details though
Excellent!
Is there an existing issue for this?
Is your feature request related to a problem you are facing?
Supporting multiple language project is a tedious task. It require synchronization oof all keys from the code to every locale file. If it is dome manually it takes a lot of time. Also in locale files hard to find new lines to be translated.
Describe the solution you'd like
I want to build CLI tool for developers. the main exec will be cake. This is proposed CLI API
This command will go through all
js
,ts
,tsx
files and look fort('****')
pattern. Then it will compare it againsten-US.json
and if any key that is not in a file it will add it there. So it will simplify developer routine. They do not need to work with locale json files. They just addt('Whatever is here')
in a code and that is it. Later before build this command will run and parse everything and add those keys to locale files.This command will open
en-US.json
and compare it's keys to every other file in locale folder and if any of those files, lacks some keys, those will be added at the end. Thus those who support translations may quickly find new untranslated lines and change it.I'll add
./bin
folder to project root. Createindex.js
file there and link ascake
command in CLI. I'll use modern commander and other NPM libraries to build modern CLI. I'll add documentation instruction for developers how to use it.I'm experienced developer.
How does this feature benefit PancakeSwap users and CAKE holders?
It is more CI\CD feature that speedup and automate multiple language support.
Anything else?
That is it.