aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-12 10:41:31 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-16 11:08:02 +0200
commit46527be35cdf4354a2ff619f66a8ac796f6d3c85 (patch)
tree9d4429d20ccfbe4e687ef1028be973494efdaeb4 /server/sonar-web
parent1ceb2bbf0a279e63de3fccb3f37e31994958e6c7 (diff)
downloadsonarqube-46527be35cdf4354a2ff619f66a8ac796f6d3c85.tar.gz
sonarqube-46527be35cdf4354a2ff619f66a8ac796f6d3c85.zip
warn about missing messages
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/scripts/utils/getMessages.js4
-rw-r--r--server/sonar-web/src/main/js/helpers/l10n.ts8
2 files changed, 10 insertions, 2 deletions
diff --git a/server/sonar-web/scripts/utils/getMessages.js b/server/sonar-web/scripts/utils/getMessages.js
index aa36cad29bb..ac9c71aeec0 100644
--- a/server/sonar-web/scripts/utils/getMessages.js
+++ b/server/sonar-web/scripts/utils/getMessages.js
@@ -34,8 +34,8 @@ function getMessages() {
const lines = content.split('\n');
lines.forEach(line => {
const parts = line.split('=');
- if (parts.length === 2) {
- messages[parts[0]] = parts[1];
+ if (parts.length > 1) {
+ messages[parts[0]] = parts.slice(1).join('=');
}
});
return messages;
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('.')}`;
}
}