if (message) {
return parameters
.map((parameter) => String(parameter))
- .reduce((acc, parameter, index) => acc.replaceAll(`{${index}}`, () => parameter), message);
+ .reduce(
+ (acc, parameter, index) => acc.replace(new RegExp(`\\{${index}\\}`, 'g'), () => parameter),
+ message
+ );
}
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line no-console
return window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
}
-function getL10nBundleFromCache() {
+function getL10nBundleFromCache(): L10nBundle {
return (window as unknown as any).sonarQubeL10nBundle ?? {};
}