Class Strings

java.lang.Object
net.sourceforge.jiu.apps.Strings
All Implemented Interfaces:
StringIndexConstants

public class Strings extends Object implements StringIndexConstants
String resource for the various apps. Each index value from StringIndexConstants has a corresponding String value for all supported natural languages.
Author:
Marco Schmidt
  • Field Details

    • LANG_ENGLISH

      public static final Integer LANG_ENGLISH
      Constant int value for the natural language English.
    • LANG_GERMAN

      public static final Integer LANG_GERMAN
      Constant int value for the natural language German.
    • LANG_SPANISH

      public static final Integer LANG_SPANISH
      Constant int value for the natural language Spanish.
    • LANG_FRENCH

      public static final Integer LANG_FRENCH
      Constant int value for the natural language French.
    • DEFAULT_LANGUAGE

      public static final Integer DEFAULT_LANGUAGE
      Constant of the default language, LANG_ENGLISH.
    • ISO_639_LANGUAGE_CODES

      private static final String[] ISO_639_LANGUAGE_CODES
      ISO 639 two-letter country codes for the supported languages, lower case.
    • LANGUAGE_CONSTANTS

      private static final Integer[] LANGUAGE_CONSTANTS
    • DEFAULT_LANGUAGE_ISO_639_CODE

      public static final String DEFAULT_LANGUAGE_ISO_639_CODE
      The ISO 639 code for the default language DEFAULT_LANGUAGE.
    • isoToConstant

      private static Hashtable isoToConstant
      A hashtable that maps from ISO 639 country codes to Integer objects with the corresponding LANG_xyz constant for that language.
    • data

      private String[] data
    • language

      private Integer language
  • Constructor Details

    • Strings

      public Strings(Integer languageConstant, String[] stringValues)
      Create a new String object for the given language and fill it with the String array.
  • Method Details

    • determineSuitableIsoCode

      public static String determineSuitableIsoCode()
      Determines an ISO 639 code of a language suitable for the environment in which the JVM is currently running. First calls determineIsoCodeFromDefaultLocale(). If that yields null, the ISO code for DEFAULT_LANGUAGE is returned. So different from determineIsoCodeFromDefaultLocale() this method always returns a non-null value.
      Returns:
      String with ISO 639 code of a language that fits the JVM environment, or the default language as fallback solution
    • determineIsoCodeFromDefaultLocale

      public static String determineIsoCodeFromDefaultLocale()
    • findLanguageCode

      public static Integer findLanguageCode(String iso639LanguageCode)
    • get

      public String get(int index)
      Gets the String denoted by the argument index. This index must be one of the int constants defined in StringIndexConstants.
      Returns:
      String with given index in the current language
      Throws:
      IllegalArgumentException - is not a valid index from StringIndexConstants
    • getLanguage

      public Integer getLanguage()
      Returns the language of this object as one of the LANG_xyz constants of this class.
    • getFileName

      public static String getFileName(int languageCode)
    • set

      public void set(Integer languageConstant, String[] values)