@tangelo/tangelo-configuration-toolkit 1.23.2 → 1.24.0
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/package.json
CHANGED
|
@@ -123,6 +123,7 @@ module.exports = function transfer (paths, {watch, lrServer} = {}) {
|
|
|
123
123
|
.pipe(shF.restore)
|
|
124
124
|
.pipe(g_plumber.stop())
|
|
125
125
|
.pipe(g_replace(c.replaceStrings))
|
|
126
|
+
.pipe(through2.obj(combineTranslations))
|
|
126
127
|
.pipe(through2.obj((file, enc, cb) => {
|
|
127
128
|
file.originalRelativePath = file.relative; // original path needed for sftp.fastPut
|
|
128
129
|
file.path = file.path.replace(/(fonto).(?:dev|dist|packages.sx-shell-.+src)(.+)/, '$1$2'); // change destination path for fonto build files
|
|
@@ -143,4 +144,35 @@ module.exports = function transfer (paths, {watch, lrServer} = {}) {
|
|
|
143
144
|
|
|
144
145
|
if (c.deliveryPack) createDeliveryPack();
|
|
145
146
|
});
|
|
146
|
-
};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// Combine custom translations/resource bundle with tdi translations
|
|
150
|
+
async function combineTranslations(file, enc, cb) {
|
|
151
|
+
const isTranslationFile = file.basename.match(/custom-UI-text.*\.properties/);
|
|
152
|
+
|
|
153
|
+
// Ignore non-translation files
|
|
154
|
+
if (!isTranslationFile) return cb(null, file);
|
|
155
|
+
|
|
156
|
+
// Remove tdi translations from pipe
|
|
157
|
+
if (file.path.match(/tdi/)) return cb();
|
|
158
|
+
|
|
159
|
+
// Get language from file name
|
|
160
|
+
const language = file.basename.match(/custom-UI-text(_.+?)?\.properties/)[1] ?? '';
|
|
161
|
+
|
|
162
|
+
// Read matching tdi translation file
|
|
163
|
+
const tdiTranslationPath = `cmscustom/tdi/custom-UI-text/custom-UI-text${language}.properties`;
|
|
164
|
+
let tdiTranslations;
|
|
165
|
+
try {
|
|
166
|
+
tdiTranslations = await fs.readFile(tdiTranslationPath, enc);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
// If tdi translation file does not exist (<5.8), leave custom translations unchanged
|
|
170
|
+
return cb(null, file);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Combine file content
|
|
174
|
+
const separator = `# Contents of ${tdiTranslationPath}`;
|
|
175
|
+
const newText = [file.contents, separator, tdiTranslations].join('\n');
|
|
176
|
+
file.contents = Buffer.from(newText);
|
|
177
|
+
return cb(null, file);
|
|
178
|
+
}
|
|
@@ -7,7 +7,7 @@ const rif = require('replace-in-file');
|
|
|
7
7
|
|
|
8
8
|
class PathSearcher {
|
|
9
9
|
#filter;
|
|
10
|
-
#ignorePaths = [_paths.tdi + '/**', 'config/cmscustom/tdi/**'];
|
|
10
|
+
#ignorePaths = [_paths.tdi + '/**', 'config/cmscustom/tdi/**', '**/node_modules/**', '**/fonto/packages_shared/**', '**/fonto/platform/**'];
|
|
11
11
|
constructor (filter, ignoreProjectPaths) {
|
|
12
12
|
this.#filter = filter;
|
|
13
13
|
this.#ignorePaths.push(...ignoreProjectPaths);
|