Class TranslationUtils


  • @Deprecated
    public class TranslationUtils
    extends java.lang.Object
    Deprecated.

    This Utility class refers to the PriintPlanner Plugin, which is subject to be removed in PublishingServer 2024/2. Please use the new utility class TranslationUtils

    The TranslationUtils class provides methods to easily access translations configured on this PubServer instance.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.function.Supplier<Translations> translationsSupplier
      Deprecated.
      Users might need to stub the translations for their unit tests.
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String getTranslation​(java.lang.String key)
      Deprecated.
      Gets the translation for a given key using the UI language of the current session, if this has been set.
      static java.lang.String getTranslation​(java.lang.String key, java.lang.String languageCode)
      Deprecated.
      Gets the translation for a given key and language.
      static java.lang.String getTranslation​(java.lang.String key, java.lang.String languageCode, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Deprecated.
      Gets the translation with replaced parameters for a given key using the given language If language is empty or no translation can be found, the key is returned.
      static Translations getTranslations()
      Deprecated.
      Gets all translations configured on this PubServer instance as configured in ISON
      static java.util.Map<java.lang.String,​java.lang.String> getTranslations​(java.lang.String languageCode)
      Deprecated.
      Gets all translations for a given language as a simple Map<String,String>
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • translationsSupplier

        public static java.util.function.Supplier<Translations> translationsSupplier
        Deprecated.

        Users might need to stub the translations for their unit tests. As this is a static class with static methods, a static supplier setting is offered. This should only be set if a manual override of Translations providers is required which usually only happens in test scopes.

    • Method Detail

      • getTranslations

        public static Translations getTranslations()
        Deprecated.

        Gets all translations configured on this PubServer instance as configured in ISON

        Returns:
        all available translations as Translations object
      • getTranslation

        public static java.lang.String getTranslation​(java.lang.String key)
        Deprecated.

        Gets the translation for a given key using the UI language of the current session, if this has been set. If language is empty or no translation can be found, the key is returned.

        Parameters:
        key - key of the translation entry
        Returns:
        localized String or key, if no language is set for this session or no translation can be found
      • getTranslation

        public static java.lang.String getTranslation​(java.lang.String key,
                                                      java.lang.String languageCode,
                                                      java.util.Map<java.lang.String,​java.lang.String> parameters)
        Deprecated.

        Gets the translation with replaced parameters for a given key using the given language If language is empty or no translation can be found, the key is returned.

        Parameters:
        key - key of the translation entry
        languageCode - 2 digit language code, e.g. "en" or "de"
        parameters - Key Value List of parameters to replace
        Returns:
        localized String or key, if no language is set for this session or no translation can be found
      • getTranslation

        public static java.lang.String getTranslation​(java.lang.String key,
                                                      java.lang.String languageCode)
        Deprecated.

        Gets the translation for a given key and language. If either language is null or empty, key cannot be found or no translation can be found for this key / language, the original key is returned.

        Parameters:
        key - key of the translation entry
        languageCode - 2 digit language code, e.g. "en" or "de"
        Returns:
        translation for the given key / language, or key, if no translation can be found
      • getTranslations

        public static java.util.Map<java.lang.String,​java.lang.String> getTranslations​(java.lang.String languageCode)
        Deprecated.

        Gets all translations for a given language as a simple Map<String,String>

        Gets all available translations for a given language as a String Map using the entry key as key and translation as value

        Parameters:
        languageCode - 2 digit language code, e.g. "en" or "de"
        Returns:
        all translations as Map<String,String>