@zohodesk/client_build_tool 0.0.11-exp.8 → 0.0.11-exp.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/shared/bundler/webpack/custom_plugins/I18nNumericIndexPlugin/utils/i18nDataLoader.js
CHANGED
|
@@ -46,20 +46,15 @@ function loadNumericMap(numericMapPath, compilation) {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
function loadAllLocaleFiles(propertiesPath, baseFileName, compilation) {
|
|
49
|
+
function loadAllLocaleFiles(propertiesPath, baseFileName, compilation, jsResourceBase) {
|
|
50
50
|
const allI18n = {};
|
|
51
|
-
const locales = [];
|
|
51
|
+
const locales = []; // Always use the jsResourceBase as en_US base
|
|
52
|
+
|
|
53
|
+
allI18n['en_US'] = jsResourceBase;
|
|
54
|
+
locales.push('en_US');
|
|
52
55
|
|
|
53
56
|
try {
|
|
54
57
|
const files = fs.readdirSync(propertiesPath);
|
|
55
|
-
files.forEach(file => {
|
|
56
|
-
if (file === baseFileName + '.properties') {
|
|
57
|
-
const filePath = path.join(propertiesPath, file);
|
|
58
|
-
const baseData = loadPropertiesFile(filePath, compilation, 'JSResources base');
|
|
59
|
-
allI18n['en_US'] = baseData;
|
|
60
|
-
locales.push('en_US');
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
58
|
files.forEach(file => {
|
|
64
59
|
if (!file.endsWith('.properties')) return;
|
|
65
60
|
const match = file.match(/^ApplicationResources_([a-z]{2}_[A-Z]{2})\.properties$/);
|
|
@@ -68,7 +63,7 @@ function loadAllLocaleFiles(propertiesPath, baseFileName, compilation) {
|
|
|
68
63
|
const locale = match[1];
|
|
69
64
|
const filePath = path.join(propertiesPath, file);
|
|
70
65
|
const localeData = loadPropertiesFile(filePath, compilation, `locale ${locale}`);
|
|
71
|
-
allI18n[locale] = { ...
|
|
66
|
+
allI18n[locale] = { ...jsResourceBase,
|
|
72
67
|
...localeData
|
|
73
68
|
};
|
|
74
69
|
|
|
@@ -97,7 +92,7 @@ function loadI18nData(options, compilation) {
|
|
|
97
92
|
const {
|
|
98
93
|
allI18n,
|
|
99
94
|
locales
|
|
100
|
-
} = loadAllLocaleFiles(propertiesPath, baseFileName, compilation);
|
|
95
|
+
} = loadAllLocaleFiles(propertiesPath, baseFileName, compilation, jsResourceBase);
|
|
101
96
|
return {
|
|
102
97
|
jsResourceBase,
|
|
103
98
|
allI18n,
|