diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-01-06 17:07:05 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-01-06 17:07:05 +0100 |
commit | 69301bd966d7f6836158ff8cc56dee119dd7f63f (patch) | |
tree | 8899e8cccb5332b9a785d0fb92ef7b2ba21786e7 /server/sonar-web/src/main/js | |
parent | d0205df442e158fe30a5d5d8131dc4ccf9a9f872 (diff) | |
download | sonarqube-69301bd966d7f6836158ff8cc56dee119dd7f63f.tar.gz sonarqube-69301bd966d7f6836158ff8cc56dee119dd7f63f.zip |
fix translations
Diffstat (limited to 'server/sonar-web/src/main/js')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/l10n.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/helpers/l10n.js b/server/sonar-web/src/main/js/helpers/l10n.js index e3c2c2a9b91..2b57dd45631 100644 --- a/server/sonar-web/src/main/js/helpers/l10n.js +++ b/server/sonar-web/src/main/js/helpers/l10n.js @@ -30,11 +30,11 @@ export function translate (...keys) { export function translateWithParameters (messageKey, ...parameters) { const message = messages[messageKey]; if (message) { - return parameters.reduce((acc, parameter, index) => ( - acc.replace(`{${index}}`, parameter) - )); + return parameters.reduce((acc, parameter, index) => { + return acc.replace(`{${index}}`, parameter); + }, message); } else { - return `${messageKey} ${parameters.join(' ')}`; + return `${messageKey}.${parameters.join('.')}`; } } @@ -80,6 +80,10 @@ export function requestMessages () { }); } +export function resetBundle (bundle) { + messages = bundle; +} + export function installGlobal () { window.t = translate; window.tp = translateWithParameters; |