Class TranslationService
java.lang.Object
org.eclipse.e4.core.services.translation.TranslationService
Provides localization service.
- Since:
- 1.2
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getResourceString
(String key, ResourceBundle resourceBundle) Returns the value out of the given ResourceBundle for the given translation key.Translates the key from the contributor.
-
Field Details
-
LOCALE
The name of the context variable with locale information- See Also:
-
locale
-
-
Constructor Details
-
TranslationService
public TranslationService()
-
-
Method Details
-
translate
Translates the key from the contributor. If translation can not be found, the original key should be returned.This method is expected to be overridden by the implementors.
- Parameters:
key
- the keycontributorURI
- URI of the contributor- Returns:
- localized value, or the original key if the translation can not be done
-
getResourceString
Returns the value out of the given ResourceBundle for the given translation key. Note that this method will only work correctly if the key matches the specification of a translation key in the application model. That means, it needs to start with a % character.- Parameters:
key
- The value that is set as key in the application model.resourceBundle
- The ResourceBundle that should be used to retrieve the translation.- Returns:
- The value value out of the given ResourceBundle for the given translation key.
-