com.ebasetech.ufs.utility
Class LanguageUtil

java.lang.Object
  extended bycom.ebasetech.ufs.utility.LanguageUtil

public class LanguageUtil
extends java.lang.Object

Handy language methods. Sorry about the deprecations. ULocale isn't really deprecated, they are just warning that it may change in the future. ULocale is only used in this file to guard against this.


Constructor Summary
LanguageUtil()
           
 
Method Summary
static java.lang.String formatLanguageIdCorrectly(java.lang.String languageId)
          take a language id (possible all caps) and format it accoring to RFC3066
static java.lang.String[] getCommonLanguageIds()
          get a list of language ids from around the World.
static java.lang.String getDefaultLanguageId_javaSystem()
           
static java.util.List getFallbackLanguages(java.lang.String languageId)
          get a list of languages.
static java.lang.String getLanguageDescription(java.lang.String languageId)
          automatically discover the name of a language given a language id.
static java.lang.String getLanguageId(java.util.Locale locale)
           
static java.util.Locale getLocale(java.lang.String languageId)
          make a normal java Locale from a languageId
static boolean languageIdsAreEquivalent(java.lang.String languageId1, java.lang.String languageId2)
          see if two language ids represent the same language.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LanguageUtil

public LanguageUtil()
Method Detail

getCommonLanguageIds

public static java.lang.String[] getCommonLanguageIds()
get a list of language ids from around the World.

Returns:

getLanguageId

public static java.lang.String getLanguageId(java.util.Locale locale)

getLocale

public static java.util.Locale getLocale(java.lang.String languageId)
make a normal java Locale from a languageId


languageIdsAreEquivalent

public static boolean languageIdsAreEquivalent(java.lang.String languageId1,
                                               java.lang.String languageId2)
see if two language ids represent the same language. (i.e. en-gb is equivalent to en_GB)


getLanguageDescription

public static java.lang.String getLanguageDescription(java.lang.String languageId)
automatically discover the name of a language given a language id. At some stage it may be neccessary to use reutrn the name in other languages.


formatLanguageIdCorrectly

public static java.lang.String formatLanguageIdCorrectly(java.lang.String languageId)
take a language id (possible all caps) and format it accoring to RFC3066


getDefaultLanguageId_javaSystem

public static java.lang.String getDefaultLanguageId_javaSystem()
Returns:
the id of the default system language/locale.

getFallbackLanguages

public static java.util.List getFallbackLanguages(java.lang.String languageId)
get a list of languages. Will come up from entered language getting more general as it goes. e.g. enter en-gb, return en-gb and en.

Parameters:
languageId - the language to start with, this will be included in the return list.