Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
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
3 changes: 2 additions & 1 deletion Composer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"l10n:extractJson": "node scripts/l10n-extractJson.js",
"l10n:transform": "node scripts/l10n-transform.js",
"l10n:babel": "babel --config-file ./babel.l10n.config.js --extensions \".ts,.tsx,.jsx,.js\" --out-dir l10ntemp ./packages",
"l10n": "yarn l10n:babel && yarn l10n:extract && yarn l10n:transform packages/server/src/locales/en-US.json && yarn l10n:extractJson packages/server/schemas && rimraf l10ntemp"
"l10n": "yarn l10n:babel && yarn l10n:extract && yarn l10n:transform packages/server/src/locales/en-US.json && yarn l10n:extractJson packages/server/schemas && rimraf l10ntemp",
"l10n:check": "node scripts/l10nCheck.js"
},
"husky": {
"hooks": {
Expand Down
4 changes: 2 additions & 2 deletions Composer/packages/server/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@
"message": "DialogFactory a un schéma manquant."
},
"dialognum_plural_0_no_bots_1_one_bot_other_bots_ha_1cf10787": {
"message": "{ dialogNum, plural,\n =0 {Aucun bot}\n =1 {Un bot}\n other {nombre de bots}\n}.\n { dialogNum, select,\n 0 {}\n other {Appuyer sur la flèche bas pour naviguer dans les résultats de recherche}\n}"
"message": "{ dialogNum, plural,\n =0 {Aucun bot}\n =1 {Un bot}\n other {# bots}\n}.\n { dialogNum, select,\n 0 {}\n other {Appuyer sur la flèche bas pour naviguer dans les résultats de recherche}\n}"
},
"disable_a5c05db3": {
"message": "Désactiver"
Expand Down Expand Up @@ -1446,7 +1446,7 @@
"message": "élément ajouté"
},
"itemcount_plural_0_no_schemas_1_one_schema_other_s_e1aea7f": {
"message": "{ itemCount, plural,\n =0 {aucun schéma}\n =1 {un schéma}\n autre {nombre de schémas}\n}.\n { itemCount, select,\n 0 {}\n autre {Appuyez sur la flèche bas pour naviguer dans les résultats de recherche}\n}"
"message": "{ itemCount, plural,\n =0 {aucun schéma}\n =1 {un schéma}\n other {# schémas}\n}.\n { itemCount, select,\n 0 {}\n autre {Appuyez sur la flèche bas pour naviguer dans les résultats de recherche}\n}"
},
"jan_28_2020_8beb36dc": {
"message": "28 jan. 2020"
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@
"message": "elemento aggiunto"
},
"itemcount_plural_0_no_schemas_1_one_schema_other_s_e1aea7f": {
"message": "{ itemCount, plural,\n =0 {No schemas}\n =1 {One schema}\n altri {# schemas}\n} sono stati trovati.\n { itemCount, select,\n 0 {}\n altro {Press down arrow key to navigate the search results}\n}"
"message": "{ itemCount, plural,\n =0 {No schemas}\n =1 {One schema}\n other {# schemas}\n} sono stati trovati.\n { itemCount, select,\n 0 {}\n altro {Press down arrow key to navigate the search results}\n}"
},
"jan_28_2020_8beb36dc": {
"message": "28 gen 2020"
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/server/src/locales/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@
"message": "öğe eklendi"
},
"itemcount_plural_0_no_schemas_1_one_schema_other_s_e1aea7f": {
"message": "{ itemCount, plural,\n = 0 {Sıfır şema}\n =1 {Bir şema}\n other {# şema}\n} bulundu.\n { itemCount, select,\n 0 {}\n other {Arama sonuçlarında gezinmek için aşağı ok tuşuna basın}\n}"
"message": "{ itemCount, plural,\n =0 {Sıfır şema}\n =1 {Bir şema}\n other {# şema}\n} bulundu.\n { itemCount, select,\n 0 {}\n other {Arama sonuçlarında gezinmek için aşağı ok tuşuna basın}\n}"
},
"jan_28_2020_8beb36dc": {
"message": "28 Oca 2020"
Expand Down
2 changes: 0 additions & 2 deletions Composer/scripts/l10n-extractJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
const fs = require('fs');
const path = require('path');

const merge = require('lodash/merge');

const { keep, transFn } = require('./l10nUtils');

const L10N_FIELDS = ['label', 'description', 'title', 'subtitle'];
Expand Down
40 changes: 40 additions & 0 deletions Composer/scripts/l10nCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable security/detect-non-literal-fs-filename */

const fs = require('fs');
const path = require('path');

const localePath = 'packages/server/src/locales';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this need to be normalized for Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm running this on a Windows machine and it worked fine.


let errorCount = 0;

const dir = fs.opendirSync(localePath);
for (;;) {
const dirent = dir.readSync();
if (dirent == null) break;
const data = fs.readFileSync(path.join(localePath, dirent.name));
const json = JSON.parse(data);
for (const [key, val] of Object.entries(json)) {
const msg = val.message;
const src = `${dirent.name} at ${key}:`;
if (/\{.*plural.*}/.exec(msg)) {
// if we're in a "plural" rules section...
if (/=\s+\d+/.exec(msg)) {
console.log(src, `whitespace between number and =`);
errorCount += 1;
}
if (/=\d+/.exec(msg) && !/other/.exec(msg)) {
console.log(src, `missing 'other' clause`);
errorCount += 1;
}
}
if (/[^'{}]'[^'{}]/.exec(msg)) {
console.log(src, `single quote between letters`);
errorCount += 1;
}
}
}

process.exit(errorCount);