Class Translator

java.lang.Object
com.cksource.ckfinder.localization.Translator

@Component public class Translator extends Object
Application-scoped translator service.
  • 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

      protected void loadLocalizationResources() throws IOException
      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 code
      errorCode - internal error code
      translationParameters - parameters to use in placeholders
      Returns:
      localized error message
    • translateErrorMessage

      public String translateErrorMessage(int errorCode, Map<String,String> translationParameters)
      Returns a localized error message for given error code and language code defined in current HTTP request.
      Parameters:
      errorCode - internal error code
      translationParameters - parameters to use in placeholders
      Returns:
      localized error message