Class LocalizationHelper

java.lang.Object
org.eclipse.e4.ui.model.LocalizationHelper

public final class LocalizationHelper extends Object
This class provides set of utility method that can be useful in typical localization scenarios.
  • Method Details

    • getLocalizedFeature

      public static String getLocalizedFeature(org.eclipse.emf.ecore.EStructuralFeature feature, MApplicationElement element)
    • getLocalizedAccessibilityPhrase

      public static String getLocalizedAccessibilityPhrase(MUIElement element)
      Returns localized accessibilityPhrase for the specified element using locale information from its context.
      Parameters:
      element - the element
      Returns:
      localized element's accessibilityPhrase, or null if no label can be found
    • getLocalizedLabel

      public static String getLocalizedLabel(MUIElement element)
      Returns localized label for the specified element using locale information from its context.
      Parameters:
      element - the element
      Returns:
      localized element's label, or null if no label can be found
    • getLocalizedTooltip

      public static String getLocalizedTooltip(MUIElement element)
      Returns localized tooltip for the specified element using locale information from its context.
      Parameters:
      element - the element
      Returns:
      localized element's tooltip, or null if no tooltip can be found
    • getLocalized

      public static String getLocalized(String key, MApplicationElement element)
      Returns localized string for the key using locale information specified in the element's context.

      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.

      Parameters:
      key - the key
      element - the model element
      Returns:
      localized key
    • getLocalized

      public static String getLocalized(String key, MApplicationElement element, IEclipseContext context)
      Returns localized string for the key from the application element using translation service from the context.

      This method will return the key itself if the context is null or there is no translation service registered in the given context.

      Parameters:
      key - the key
      element - the model element
      context - the context
      Returns:
      localized key