aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2014-03-27 11:16:29 (EDT)
committerThomas Schindl2014-03-27 17:46:02 (EDT)
commit89be22cf7469ecde426e4b75493d7c29ec9733f7 (patch)
treea723ae2d5feb808bcff86d62a6cf6f84ca6ae6da
parent4e61992bddbcc4508556d441a50e9f18fcd7f9a3 (diff)
downloadeclipse.platform.ui-89be22cf7469ecde426e4b75493d7c29ec9733f7.zip
eclipse.platform.ui-89be22cf7469ecde426e4b75493d7c29ec9733f7.tar.gz
eclipse.platform.ui-89be22cf7469ecde426e4b75493d7c29ec9733f7.tar.bz2
Bug 431367 - Localized value will be the key itself in case there is norefs/changes/01/24001/2
context from which the TranslationService can be retrieved Change-Id: I7c1464fa22164ef219d50ff8607a2877d3defc18 Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java
index d15278c..9487d8a 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/LocalizationHelper.java
@@ -94,27 +94,29 @@ final public class LocalizationHelper {
* Returns localized string for the key using locale information specified
* in the element's context.
* <p>
- * This method may return <code>null</code> if the context can not be found
- * for the model element.
+ * This method will return the key itself if the context can not be found
+ * for the model element or there is no translation service registered in
+ * that context.
* </p>
*
* @param key
* the key
* @param element
* the model element
- * @return localized key, or <code>null</code> if context information can
- * not be found for the model element
+ * @return localized key
*/
public static String getLocalized(String key, MApplicationElement element) {
IEclipseContext context = ModelUtils.getContainingContext(element);
- if (context == null)
- return null;
return getLocalized(key, element, context);
}
/**
* Returns localized string for the key from the application element using
* translation service from the context.
+ * <p>
+ * This method will return the key itself if the context is <code>null</code>
+ * or there is no translation service registered in the given context.
+ * </p>
*
* @param key
* the key
@@ -126,8 +128,8 @@ final public class LocalizationHelper {
*/
public static String getLocalized(String key, MApplicationElement element,
IEclipseContext context) {
- if (key == null)
- return null;
+ if (key == null || context == null)
+ return key;
TranslationService translation = context.get(TranslationService.class);
if (translation == null)
return key;