UNPKG

669 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.patchNLS = void 0;
4const regex = /^%([\w\d.]+)%$/i;
5function 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}
17function patchNLS(manifest, translations) {
18 const patcher = createPatcher(translations);
19 return JSON.parse(JSON.stringify(manifest, (_, value) => patcher(value)));
20}
21exports.patchNLS = patchNLS;
22//# sourceMappingURL=nls.js.map
\No newline at end of file