skrueger.i8n
Class I8NUtil

java.lang.Object
  extended by skrueger.i8n.I8NUtil

public class I8NUtil
extends Object


Constructor Summary
I8NUtil()
           
 
Method Summary
static Translation createFromOneLIne(String oneLineCoded)
          Creates a Translation
If oneLineCoded is empty or null, NO TRANSLATION is set.
static Set<String> getLanguageCodes()
           
static Locale getLocaleFor(String code)
           
static boolean isEmpty(String transString)
          A convenience method that checks if the String returned by from a Translation object contains a "valid" translation for the active language.
static boolean isEmpty(Translation trans)
          A convenience method that checks if the Translation object contains a translation for the active language.
static boolean isValidISOLangCode(String code)
           
static String toOneLine(Translation source)
          Returns the Translation to a String of the Format: "de{Baum}en{tree}"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

I8NUtil

public I8NUtil()
Method Detail

createFromOneLIne

public static Translation createFromOneLIne(String oneLineCoded)
Creates a Translation

  • If oneLineCoded is empty or null, NO TRANSLATION is set.
  • If format can't be recognized, the String is interpreted as the translation in the language


  • toOneLine

    public static String toOneLine(Translation source)
    Returns the Translation to a String of the Format: "de{Baum}en{tree}"


    isValidISOLangCode

    public static boolean isValidISOLangCode(String code)
    Parameters:
    code -
    Returns:
    true if the code paramter is a valid ISO Language code

    getLanguageCodes

    public static Set<String> getLanguageCodes()
    Returns:
    All language codes available in java.util.Locale.getISOLanguages() without duplicates.

    getLocaleFor

    public static Locale getLocaleFor(String code)
    Parameters:
    code - A two-letter language code.
    Returns:
    null or one (of many possible) Locale that uses this language.

    isEmpty

    public static boolean isEmpty(Translation trans)
    A convenience method that checks if the Translation object contains a translation for the active language. A String containing only spaces will return false.

    Parameters:
    trans - Translation to check.

    isEmpty

    public static boolean isEmpty(String transString)
    A convenience method that checks if the String returned by from a Translation object contains a "valid" translation for the active language. A String containing only spaces or equals Translation.NO_TRANSLATION will return false.

    Parameters:
    transString - String to check.