Class Translation

    • Constructor Detail

      • Translation

        public Translation()
    • Method Detail

      • of

        public static Translation of​(Locale locale,
                                     String value)
        init Translation
        Parameters:
        locale - Locale of value
        value - text
        Returns:
        new Translation instant
      • translation

        public static Translation translation​(String translation)
        init Translation with value for Locale of LocaleContextHolder
        Parameters:
        translation - value
        Returns:
        new Translation instant
      • getLocales

        public Set<Locale> getLocales()
      • getTranslated

        @Nullable
        public String getTranslated​(Locale locale)
        lookup for locale in following order:
        • lookup for exact locale (de-DE-bayrisch)
        • afterwards for only parts of the locale-tag (de-DE, de)
        • afterwards fpr (en)
        • then for (ROOT "")
        • when only one translation exists return it
        Parameters:
        locale - exact match locale
        Returns:
        translated value when found
      • getTranslated

        @Nullable
        public String getTranslated()
        lookup with locale of LocaleContextHolder
        Returns:
        translated value when found
      • hasLocale

        public boolean hasLocale​(Locale locale)
        exactly search within map if locale contains
      • hasLocaleLooselyFilter

        public boolean hasLocaleLooselyFilter​(Locale locale)
        uses the LocaleFilter function to search if locale could be found