com.ansys.ingress.client.api.utils

## Class Localizer

- java.lang.Object
- - com.ansys.ingress.client.api.utils.Localizer

-     public class Localizer
      extends java.lang.Object

  Localizer is used to get localized strings.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Set<java.lang.String>` | `packages`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `Localizer(java.util.Locale locale)` Creates a new instance of Localizer.
    `protected` | `Localizer(java.util.Locale locale, java.lang.String defaultPkg)` Creates a new instance of Localizer.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addPackage(java.lang.String name)` Adds a package to the localizer.
    `static java.util.Locale` | `getDefaultLocale()` Gets an instance of localizer for the given package and the default locale.
    `static Localizer` | `getInstance(java.util.Locale locale)` Gets an instance of localizer for the given package and locale.
    `static Localizer` | `getInstance(java.lang.String language)` Gets an instance of localizer for the given language.
    `java.util.Locale` | `getLocale()`
    `java.lang.String` | `getString(java.lang.String key, java.lang.Object... params)` Gets a localized string.
    `static java.util.List<java.util.Locale>` | `getSupportedLocales()`
    `void` | `setLocale(java.util.Locale locale)` Sets the locale used by this localizer.
    `static void` | `useLanguageSettingsDotTxt(boolean useLangFile)` Sets whether the localizer should use languagesetting.txt.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### packages

          protected java.util.Set<java.lang.String> packages

  - ### Constructor Detail

    - #### Localizer

          protected Localizer(java.util.Locale locale)

      Creates a new instance of Localizer.
      Parameters:
        `locale` - - the locale

    - #### Localizer

          protected Localizer(java.util.Locale locale,
                              java.lang.String defaultPkg)

      Creates a new instance of Localizer.
      Parameters:
        `locale` - - the locale
        `defaultPkg` - - the defaultPkg

  - ### Method Detail

    - #### getDefaultLocale

          public static java.util.Locale getDefaultLocale()

      Gets an instance of localizer for the given package and the default locale.
      Returns:
        Returns a Localizer instance.

    - #### getInstance

          public static Localizer getInstance(java.util.Locale locale)

      Gets an instance of localizer for the given package and locale. If useLangFile=true and getDefaultLocale method can load langFile, then locale param is ignored
      Parameters:
        `locale` - - the locale
      Returns:
        Returns a Localizer instance.

    - #### getInstance

          public static Localizer getInstance(java.lang.String language)

      Gets an instance of localizer for the given language.
      Parameters:
        `language` - - the language
      Returns:
        Returns a Localizer instance.

    - #### getLocale

          public java.util.Locale getLocale()

      Returns:
        Returns the Locale being used by Localizer instances.

    - #### getString

          public java.lang.String getString(java.lang.String key,
                                            java.lang.Object... params)

      Gets a localized string.
      Parameters:
        `key` - - the key to the string
        `params` - - optional parameters
      Returns:
        Returns the localized string.

    - #### getSupportedLocales

          public static java.util.List<java.util.Locale> getSupportedLocales()

      Returns:
        Return a list of the supported locales. A supported locale is one for which a messages.properties file exists.

    - #### addPackage

          public void addPackage(java.lang.String name)

      Adds a package to the localizer.
      Parameters:
        `name` - name of the package to add.

    - #### setLocale

          public void setLocale(java.util.Locale locale)

      Sets the locale used by this localizer.
      Parameters:
        `locale` - the locale to use

    - #### useLanguageSettingsDotTxt

          public static void useLanguageSettingsDotTxt(boolean useLangFile)

      Sets whether the localizer should use languagesetting.txt.
      Parameters:
        `useLangFile` - if true, use languagesettings.txt