1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.patchNLS = void 0;
|
4 | const regex = /^%([\w\d.]+)%$/i;
|
5 | function createPatcher(translations) {
|
6 | return (value) => {
|
7 | if (typeof value !== 'string') {
|
8 | return value;
|
9 | }
|
10 | const match = regex.exec(value);
|
11 | if (!match) {
|
12 | return value;
|
13 | }
|
14 | return (translations[match[1]] ?? value);
|
15 | };
|
16 | }
|
17 | function patchNLS(manifest, translations) {
|
18 | const patcher = createPatcher(translations);
|
19 | return JSON.parse(JSON.stringify(manifest, (_, value) => patcher(value)));
|
20 | }
|
21 | exports.patchNLS = patchNLS;
|
22 |
|
\ | No newline at end of file |