Class Translator
java.lang.Object
com.cksource.ckfinder.localization.Translator
Application-scoped translator service.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Loads localization files from resources.translateErrorMessage
(int errorCode, Map<String, String> translationParameters) Returns a localized error message for given error code and language code defined in current HTTP request.translateErrorMessage
(String langCode, int errorCode, Map<String, String> translationParameters) Returns a localized error message for given error and language codes.
-
Constructor Details
-
Translator
public Translator()Constructs translator instance. Localization resources loading is done in constructor, so it happens only once, on the start of the application. The map is not modified after this, so it is thread-safe.
-
-
Method Details
-
loadLocalizationResources
Loads localization files from resources.- Throws:
IOException
- if loading localization files fails
-
translateErrorMessage
public String translateErrorMessage(String langCode, int errorCode, Map<String, String> translationParameters) Returns a localized error message for given error and language codes.- Parameters:
langCode
- language codeerrorCode
- internal error codetranslationParameters
- parameters to use in placeholders- Returns:
- localized error message
-
translateErrorMessage
Returns a localized error message for given error code and language code defined in current HTTP request.- Parameters:
errorCode
- internal error codetranslationParameters
- parameters to use in placeholders- Returns:
- localized error message
-