It's a tool to sync files in Devographics repositories with translations for "State of" projects. You can easily update translation file in target repository based on the original one.
Warning: It's a simple tool to parse and compare files in their current state. It does not depend on the git-based history of changes.
Here is a list of all repositories.
en-US locale is considered a base, but it can be any of them as you need.
- Node.js (20+) + npm
Let's say you have devographics folder with cloned locale repos inside of it,
e.g. locale-en-US and locale-ua-UA.
Clone this repository to have it inside devographics as well.
| locale-en-US
devographics | locale-ua-UA
| devographics-translation-sync
Install dependencies:
npm installCreate an environment file by example:
cp .env.example .envUpdate locales and file name in .env file up to your needs before syncing.
Run this command to update state_of_js.yml file in locale-ua-UA repo,
basing on the file of the same name in locale-en-US repo:
npm run syncAlso you can either update locales and file name in .env file or set/override
them from terminal:
FILE_NAME=state_of_js.yml BASE_LOCALE=en-US DICT_LOCALE=ua-UA npm run sync- If file is missing in your repo, the base file will be copied.
- All untranslated values will be also extracted into
untranslated-[FILE_NAME]file in target repository so you can easily send it to translation services.
Run this command to lint js files (and format in a simple way):
npm run lintAfter the first syncing, some additional effects (which is okay) may happen:
- file may be formatted to use 2-space offset between levels;
- comments and values may be shifted as
ymlstructure will be revaluated during parsing; - double quote is used by default for text wrapping instead of single quote;
- some wrapping quotes may be removed if they are unnecessary;
- paragraphs in folded multiline blocks may become one line, explanation.
These effects should not happen later as file will become valid (except for known bugs)
In the folded multiline blocks (> operator), paragraph lines should end with
additional space at the end (except for the ending line):
t: >
First part,[one space here]
second part[one space here]
and the ending part of paragraph
New paragraphThat's required to correctly reconstruct the original formatting of the folded blocks. And additional spaces won't break html rendering in browser.
Otherwise, that value will appear as following after syncing :
t: >
First part, second part and the ending part of paragraph
New paragraphwhich is correct behavior, though it breaks original file formatting.
Technique with space is used because of intention to keep line-to-line equality between base translation file and derived ones. Without this requirement it may be omitted fully.
There are bugs which require manual editing in files after syncing:
doublegeneral.js2023.survey_introkeys insurveysfile- double
user_info.other_surveys.questionkeys incommonfile doubleuser_info.disability_status.questionkeys incommonfiledoublecharts.freeform_datakeys inresultsfileWinner:value at wrong level insurveysfile- double
options.top_currently_missing_from_js.static_typingkeys instate_of_jsfile - double
options.top_currently_missing_from_js.standard_librarykeys instate_of_jsfile - double
options.top_currently_missing_from_js.pipe_operatorkeys instate_of_jsfile - double
options.top_currently_missing_from_js.decoratorskeys instate_of_jsfile - double
tools.monorepo_tools_ratios.takeaway.js2024keys injs2024file
They should be fixed directly in base files by translators later.