Skip to content

Commit 54c09a5

Browse files
committed
ci: remove unused lastTranslatedLocale.json as you need to directly edit expert translations now
1 parent 7adae5e commit 54c09a5

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

docs/02-Adding-Translations.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ A special folder called the `root` folder houses the reference English translati
3030
Each `src/nls/<locale>` folder contains similar files, plus a few additional ones:
3131
1. `expertTranslations.json` where you can provide expert translations for specific English strings to locale strings. This expert translation will be used instead of machine translations if present for a string.
3232
2. `strings.js` - The full list of translated text for the locale.
33-
3. Apart from the above two there are 2 autogenerated files that should not be edited: `lastTranslated.json` and `lastTranslatedLocale.json`.
33+
3. Apart from the above two there are 2 autogenerated files that should not be edited: `lastTranslated.json`.
3434

3535
## Autogenerated and Manual translations
36-
When any string changes are made to `src/nls/root/strings.js` or any `src/nls/<locale>/strings.js`, it will automatically be scanned by GitHub Actions and the corresponding translations will be generated. A pull request will be raised with the new translations.
36+
When any string changes are made to `src/nls/root/strings.js` , it will automatically be scanned by GitHub Actions and the corresponding translations will be generated. A pull request will be raised with the new translations.
3737

3838
You can also run the translation command locally if you have the AWS/GCP keys with the command. This is mostly FYI for phoenix internal devs.
3939
```bash
@@ -57,7 +57,6 @@ Say we want to add a new language translation `ko`. We have to do the following
5757
2. In file `nls/root/strings-app.js` add the line `"LOCALE_KO": "한국어",` where `한국어` is `Korean` in Korean language.
5858
3. Create a new folder `nls/ko`.
5959
4. Create a new file `nls/ko/strings.js` with the content `define({});`
60-
5. Create three new files `nls/ko/lastTranslated.json`, `nls/ko/lastTranslatedLocale.json` and
6160
`nls/ko/expertTranslations.json` with the content `{}`
6261

6362
Once the code is checked in, the translation will be auto generated.

gulpfile.js/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ function cleanUnwantedFilesInDist() {
6565
return del([
6666
'dist/nls/*/expertTranslations.json',
6767
'dist/nls/*/lastTranslated.json',
68-
'dist/nls/*/lastTranslatedLocale.json',
6968
'dist/nls/*/*.js.map',
7069
'dist/extensions/default/*/unittests.js.map'
7170
]);
@@ -393,7 +392,6 @@ const DISALLOWED_EXTENSIONS_TO_CACHE = ["map", "nuspec", "partial", "pre", "post
393392
const EXCLUDE_PATTERNS_FROM_CACHE = [
394393
/src\/nls\/.*expertTranslations\.json$/,
395394
/src\/nls\/.*lastTranslated\.json$/,
396-
/src\/nls\/.*lastTranslatedLocale\.json$/,
397395
/extensions\/registry\/registry\.json$/
398396
];
399397

gulpfile.js/translateStrings.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,14 @@ async function coreAiTranslate(stringsToTranslate, lang) {
111111
* 1. nls/<lang>/lastTranslated.json holds the last root english strings that was automatically translated. This will be
112112
* used to compare with the current `root/strings.js`. We can determine which strings have changed from the last locale
113113
* translation done and translate only those changed strings.
114-
* 2. nls/<lang>/lastTranslatedLocale.json same as `lastTranslated.json` but holds the locale translations instead of
115-
* english. Holds the last locale strings that was automatically translated.
116-
* 3. `expertTranslations.json` is a dictionary from english string to locale string that can be used to provide manual
114+
* 2. `expertTranslations.json` is a dictionary from english string to locale string that can be used to provide manual
117115
* expert translations. When translating, we will check for an available translation in the expert translation json
118116
* before calling google/aws translate. This file is also auto updated when someone provides a translation override
119117
* in a specific locale.
120118
*
121119
* ## How we translate
122120
* First we deduce if there are any manual translations done in `<locale>/strings.js` as users can explicitly provide
123-
* translations like these: https://github.com/phcode-dev/phoenix/pull/588 . We check the `<lang>/strings.js` with
124-
* `<lang>/lastTranslatedLocale.json` to determine translation overrides and update the `expertTranslations.json`
125-
* dictionary with the overrides.
126-
*
121+
* translations like these: https://github.com/phcode-dev/phoenix/pull/588 .
127122
* Then, we figure out the changed strings that needs translation by comparing `root/strings.js` with
128123
* `<lang>/lastTranslated.json`. Then we translate with aws/google translate.
129124
*
@@ -195,7 +190,6 @@ async function _processLang(lang) {
195190
let fileToWrite = `${FILE_HEADER}${translatedStringsJSON}${FILE_FOOTER}`;
196191
fs.writeFileSync(`src/nls/${lang}/strings.js`, fileToWrite);
197192
fs.writeFileSync(`src/nls/${lang}/lastTranslated.json`, JSON.stringify(updatedLastTranslatedJSON, null, 2));
198-
fs.writeFileSync(`src/nls/${lang}/lastTranslatedLocale.json`, JSON.stringify(translations, null, 2));
199193
}
200194

201195
async function translate() {

0 commit comments

Comments
 (0)