aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2014-05-09 14:41:51 (EDT)
committerPaul Webster2014-05-09 15:22:28 (EDT)
commit291c75ea73f353e175c106007849879676d17852 (patch)
treeaed905ac36970f2027b75e55ce81f1a302e5ecfb
parent47f11c69bdb654009053bd19d70c54b8b6d908ca (diff)
downloadeclipse.platform.ui-291c75ea73f353e175c106007849879676d17852.zip
eclipse.platform.ui-291c75ea73f353e175c106007849879676d17852.tar.gz
eclipse.platform.ui-291c75ea73f353e175c106007849879676d17852.tar.bz2
Bug 433890 - Use the converted Locale instead of the Locale StringI20140511-2000I20140510-1500I20140509-2000refs/changes/31/25831/4
parameter to avoid invalid Locale values in the context Change-Id: I1d535f0c4a81004030eee4c7a6055d9203b922dd Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java10
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java4
2 files changed, 11 insertions, 3 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
index 790a065..dab54ce 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
@@ -37,6 +37,7 @@ import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.contexts.RunAndTrack;
import org.eclipse.e4.core.internal.services.EclipseAdapter;
+import org.eclipse.e4.core.internal.services.ResourceBundleHelper;
import org.eclipse.e4.core.services.adapter.Adapter;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
import org.eclipse.e4.core.services.log.ILoggerProvider;
@@ -538,8 +539,13 @@ public class E4Application implements IApplication {
});
// translation
- String locale = Locale.getDefault().toString();
- appContext.set(TranslationService.LOCALE, locale);
+ String defaultLocaleString = Locale.getDefault().toString();
+
+ // ensure the default Locale value is correct
+ Locale transformedLocale = ResourceBundleHelper.toLocale(
+ defaultLocaleString, Locale.ENGLISH);
+
+ appContext.set(TranslationService.LOCALE, transformedLocale.toString());
TranslationService bundleTranslationProvider = TranslationProviderFactory
.bundleTranslationService(appContext);
appContext.set(TranslationService.class, bundleTranslationProvider);
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java
index 4a16f1f..ee517fc 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/LocaleChangeServiceImpl.java
@@ -76,7 +76,9 @@ public class LocaleChangeServiceImpl implements ILocaleChangeService {
Locale locale = ResourceBundleHelper.toLocale(localeString);
// set the locale to the application context
- this.application.getContext().set(TranslationService.LOCALE, localeString);
+ // use the resolved locale instead of the given locale string to avoid invalid locales
+ // in context
+ this.application.getContext().set(TranslationService.LOCALE, locale.toString());
// update model
updateLocalization(this.application.getChildren());