aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-05-11 15:26:03 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-05-12 12:37:19 +0200
commitb451f859c4fc8e0a694c18e175ddc931e1702cd9 (patch)
tree5058793bdd549539bd6de42c905dc70891862b00 /sonar-core/src/main
parent4367c635b9e660bec4e30929143d6b1bfd32f2de (diff)
downloadsonarqube-b451f859c4fc8e0a694c18e175ddc931e1702cd9.tar.gz
sonarqube-b451f859c4fc8e0a694c18e175ddc931e1702cd9.zip
SONAR-9193 WS api/l10n/index returns the effective BCP47 language tag used
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
index 42a1707e182..ae746c6580b 100644
--- a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
+++ b/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
@@ -226,8 +226,14 @@ public class DefaultI18n implements I18n, Startable {
return propertyToBundles.keySet();
}
+ public Locale getEffectiveLocale(Locale locale) {
+ Locale bundleLocale = ResourceBundle.getBundle(BUNDLE_PACKAGE + "core", locale, this.classloader, this.control).getLocale();
+ locale.getISO3Language();
+ return bundleLocale.getLanguage().isEmpty() ? Locale.ENGLISH : bundleLocale;
+ }
+
@CheckForNull
- private String formatMessage(@Nullable String message, Object... parameters) {
+ private static String formatMessage(@Nullable String message, Object... parameters) {
if (message == null || parameters.length == 0) {
return message;
}