Remove hardcoded INCLUDE_LANGS
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
e93a12d1fa
commit
501f01cdd5
1 changed files with 4 additions and 54 deletions
|
@ -3,59 +3,9 @@
|
||||||
const loaderUtils = require("loader-utils");
|
const loaderUtils = require("loader-utils");
|
||||||
|
|
||||||
// copies the resources into the webapp directory.
|
// copies the resources into the webapp directory.
|
||||||
//
|
|
||||||
|
|
||||||
// Languages are listed manually, so we can choose when to include a translation in the app
|
const I18N_BASE_PATH = "src/i18n/strings/";
|
||||||
// (because having a translation with only 3 strings translated is just frustrating)
|
const INCLUDE_LANGS = fs.readdirSync(I18N_BASE_PATH).filter((fn) => fn.endsWith(".json"));
|
||||||
// This could readily be automated, but it's nice to explicitly control when new languages are available.
|
|
||||||
const INCLUDE_LANGS = [
|
|
||||||
"bg",
|
|
||||||
"ca",
|
|
||||||
"cs",
|
|
||||||
"da",
|
|
||||||
"de_DE",
|
|
||||||
"el",
|
|
||||||
"en_EN",
|
|
||||||
"en_US",
|
|
||||||
"eo",
|
|
||||||
"es",
|
|
||||||
"et",
|
|
||||||
"eu",
|
|
||||||
"fi",
|
|
||||||
"fr",
|
|
||||||
"gl",
|
|
||||||
"he",
|
|
||||||
"hi",
|
|
||||||
"hu",
|
|
||||||
"id",
|
|
||||||
"is",
|
|
||||||
"it",
|
|
||||||
"ja",
|
|
||||||
"kab",
|
|
||||||
"ko",
|
|
||||||
"lo",
|
|
||||||
"lt",
|
|
||||||
"lv",
|
|
||||||
"nb_NO",
|
|
||||||
"nl",
|
|
||||||
"nn",
|
|
||||||
"pl",
|
|
||||||
"pt",
|
|
||||||
"pt_BR",
|
|
||||||
"ru",
|
|
||||||
"sk",
|
|
||||||
"sq",
|
|
||||||
"sr",
|
|
||||||
"sv",
|
|
||||||
"te",
|
|
||||||
"th",
|
|
||||||
"tr",
|
|
||||||
"uk",
|
|
||||||
"vi",
|
|
||||||
"vls",
|
|
||||||
"zh_Hans",
|
|
||||||
"zh_Hant",
|
|
||||||
];
|
|
||||||
|
|
||||||
// cpx includes globbed parts of the filename in the destination, but excludes
|
// cpx includes globbed parts of the filename in the destination, but excludes
|
||||||
// common parents. Hence, "res/{a,b}/**": the output will be "dest/a/..." and
|
// common parents. Hence, "res/{a,b}/**": the output will be "dest/a/..." and
|
||||||
|
@ -154,7 +104,7 @@ function next(i, err) {
|
||||||
|
|
||||||
function genLangFile(lang, dest) {
|
function genLangFile(lang, dest) {
|
||||||
const reactSdkFile = "node_modules/matrix-react-sdk/src/i18n/strings/" + lang + ".json";
|
const reactSdkFile = "node_modules/matrix-react-sdk/src/i18n/strings/" + lang + ".json";
|
||||||
const riotWebFile = "src/i18n/strings/" + lang + ".json";
|
const riotWebFile = I18N_BASE_PATH + lang + ".json";
|
||||||
|
|
||||||
let translations = {};
|
let translations = {};
|
||||||
[reactSdkFile, riotWebFile].forEach(function (f) {
|
[reactSdkFile, riotWebFile].forEach(function (f) {
|
||||||
|
@ -210,7 +160,7 @@ function genLangList(langFileMap) {
|
||||||
*/
|
*/
|
||||||
function watchLanguage(lang, dest, langFileMap) {
|
function watchLanguage(lang, dest, langFileMap) {
|
||||||
const reactSdkFile = "node_modules/matrix-react-sdk/src/i18n/strings/" + lang + ".json";
|
const reactSdkFile = "node_modules/matrix-react-sdk/src/i18n/strings/" + lang + ".json";
|
||||||
const riotWebFile = "src/i18n/strings/" + lang + ".json";
|
const riotWebFile = I18N_BASE_PATH + lang + ".json";
|
||||||
|
|
||||||
// XXX: Use a debounce because for some reason if we read the language
|
// XXX: Use a debounce because for some reason if we read the language
|
||||||
// file immediately after the FS event is received, the file contents
|
// file immediately after the FS event is received, the file contents
|
||||||
|
|
Loading…
Reference in a new issue