Skip to content

Commit f82aba4

Browse files
authored
Improve plugin package localization (#15142)
1 parent 28278ae commit f82aba4

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

packages/plugin-ext/src/hosted/node/hosted-plugin-localization-service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,11 @@ function coerceLocalizations(translations: Record<string, string | LocalizeInfo>
376376
return translations as Record<string, string>;
377377
}
378378

379-
const NLS_REGEX = /^%([\w\d.-]+)%$/i;
380-
381379
function localizePackage(value: unknown, translations: PackageTranslation, callback: (key: string, defaultValue: string) => string): unknown {
382380
if (typeof value === 'string') {
383-
const match = NLS_REGEX.exec(value);
384381
let result = value;
385-
if (match) {
386-
const key = match[1];
382+
if (value.startsWith('%') && value.endsWith('%')) {
383+
const key = value.slice(1, -1);
387384
if (translations.translation) {
388385
result = translations.translation[key];
389386
} else if (translations.default) {

0 commit comments

Comments
 (0)