diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-12 10:41:31 +0200 |
---|---|---|
committer | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-10-16 11:08:02 +0200 |
commit | 46527be35cdf4354a2ff619f66a8ac796f6d3c85 (patch) | |
tree | 9d4429d20ccfbe4e687ef1028be973494efdaeb4 /server/sonar-web/src | |
parent | 1ceb2bbf0a279e63de3fccb3f37e31994958e6c7 (diff) | |
download | sonarqube-46527be35cdf4354a2ff619f66a8ac796f6d3c85.tar.gz sonarqube-46527be35cdf4354a2ff619f66a8ac796f6d3c85.zip |
warn about missing messages
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/l10n.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/helpers/l10n.ts b/server/sonar-web/src/main/js/helpers/l10n.ts index b8959977de8..a6598790266 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.ts +++ b/server/sonar-web/src/main/js/helpers/l10n.ts @@ -40,6 +40,11 @@ export const DEFAULT_LANGUAGE = 'en'; export function translate(...keys: string[]): string { const messageKey = keys.join('.'); + if (process.env.NODE_ENV === 'development') { + if (!messages[messageKey]) { + console.error(`No message for: ${messageKey}`); + } + } return messages[messageKey] || messageKey; } @@ -53,6 +58,9 @@ export function translateWithParameters( .map(parameter => String(parameter)) .reduce((acc, parameter, index) => acc.replace(`{${index}}`, parameter), message); } else { + if (process.env.NODE_ENV === 'development') { + console.error(`No message for: ${messageKey}`); + } return `${messageKey}.${parameters.join('.')}`; } } |