Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion gulpfile.js/translateStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,22 @@ function shallowEqual(obj1, obj2) {
return true;
}

/**
* Returns a new object whose keys are sorted in ascending order.
*
* @param {Object} obj - The object to sort by keys.
* @returns {Object} sortedObj - A new object with sorted keys.
*/
function getSortedObject(obj) {
const sortedObj = {};
// Gather all keys, sort them, then build the new object in that order
const sortedKeys = Object.keys(obj).sort();
for (const key of sortedKeys) {
sortedObj[key] = obj[key];
}
return sortedObj;
}

/**
* Auto translations scans the following files to determine which strings have changed and needs to be translated:
* 1. nls/<lang>/lastTranslated.json holds the last root english strings that was automatically translated. This will be
Expand Down Expand Up @@ -326,7 +342,8 @@ async function _processLang(lang) {
fs.writeFileSync(`src/nls/${lang}/strings.js`, fileToWrite);
}
if(!shallowEqual(updatedLastTranslatedJSON, lastTranslated)){
fs.writeFileSync(`src/nls/${lang}/lastTranslated.json`, JSON.stringify(updatedLastTranslatedJSON, null, 2));
const sortedList = getSortedObject(updatedLastTranslatedJSON);
fs.writeFileSync(`src/nls/${lang}/lastTranslated.json`, JSON.stringify(sortedList, null, 2));
}
}

Expand Down
2,344 changes: 1,172 additions & 1,172 deletions src/nls/ar/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/bg/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/cs/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/da/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/de/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/el/lastTranslated.json

Large diffs are not rendered by default.

2,344 changes: 1,172 additions & 1,172 deletions src/nls/en-gb/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/es/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/fa-ir/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/fi/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/fr/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/gl/lastTranslated.json

Large diffs are not rendered by default.

2,344 changes: 1,172 additions & 1,172 deletions src/nls/hi/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/hr/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/hu/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/id/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/it/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/ja/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/ko/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/lv/lastTranslated.json

Large diffs are not rendered by default.

2,344 changes: 1,172 additions & 1,172 deletions src/nls/ml/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/nb/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/nl/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/pl/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/pt-br/lastTranslated.json

Large diffs are not rendered by default.

2,352 changes: 1,176 additions & 1,176 deletions src/nls/pt-pt/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/ro/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/ru/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/sk/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/sr/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/sv/lastTranslated.json

Large diffs are not rendered by default.

2,352 changes: 1,176 additions & 1,176 deletions src/nls/tr/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/uk/lastTranslated.json

Large diffs are not rendered by default.

2,344 changes: 1,172 additions & 1,172 deletions src/nls/ur/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/zh-cn/lastTranslated.json

Large diffs are not rendered by default.

2,354 changes: 1,177 additions & 1,177 deletions src/nls/zh-tw/lastTranslated.json

Large diffs are not rendered by default.

Loading