Class I18nString.Builder

  • Enclosing class:
    I18nString

    public static final class I18nString.Builder
    extends Object
    Allows creating a I18nString in a handier way.
    • Constructor Detail

      • Builder

        public Builder()
      • Builder

        public Builder​(@NonNull
                       String defaultValue)
      • Builder

        public Builder​(@NonNull
                       I18nString toCopy)
    • Method Detail

      • put

        public I18nString.Builder put​(@NonNull
                                      String languageCode,
                                      @NonNull
                                      String value)
        Add string translated into another language.
        Parameters:
        languageCode - language name in ISO 639-2 format. If is null, this method does nothing.
        value - translated into provided language. If is null, this method does nothing.
        Returns:
        current I18nString.Builder instance
      • put

        public I18nString.Builder put​(@NonNull
                                      Locale locale,
                                      @NonNull
                                      String value)
        Add string translated into another language.
        Parameters:
        locale - its Locale.getISO3Language() stands for the language of the string. If is null, this method does nothing.
        value - string translated into provided language. If is null, this method does nothing.
        Returns:
        current I18nString.Builder instance
      • anyLanguage

        public I18nString.Builder anyLanguage​(@NonNull
                                              String value)
        Add string to use as a default value, when there is no translation to some language
        Parameters:
        value - default string value If is null, this method does nothing.
        Returns:
        current I18nString.Builder instance