org.loom.util
Class LocaleUtils

java.lang.Object
  extended by org.loom.util.LocaleUtils

public class LocaleUtils
extends java.lang.Object


Constructor Summary
LocaleUtils()
           
 
Method Summary
static void addHtmlEntity(java.util.Currency currency, java.lang.String symbol)
          Add a currency HTML entity
static java.lang.String getHtmlEntity(java.util.Currency currency)
           
static java.util.List<java.lang.String> getLocalizedFilenames(java.lang.String prefix, java.lang.String suffix, java.util.Locale... locales)
          Elaborates a list of localized filenames to check, from more to less specific.
static java.util.Locale toLocale(java.lang.String serializedLocale)
          Converts a Locale from the ISO form lang_country_variant to the corresponding Locale instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleUtils

public LocaleUtils()
Method Detail

addHtmlEntity

public static void addHtmlEntity(java.util.Currency currency,
                                 java.lang.String symbol)
Add a currency HTML entity

Parameters:
currency - the currency to use as key
symbol - the HTML text to print to represent that symbol

getHtmlEntity

public static java.lang.String getHtmlEntity(java.util.Currency currency)
Parameters:
currency - the Currency that will be printed as HTML
Returns:
the HTML text to represent the provided Currency, null if not found. Ex: getCurrencySymbol(Currency.getInstance("EUR")) -> "&euro"

toLocale

public static java.util.Locale toLocale(java.lang.String serializedLocale)
Converts a Locale from the ISO form lang_country_variant to the corresponding Locale instance


getLocalizedFilenames

public static java.util.List<java.lang.String> getLocalizedFilenames(java.lang.String prefix,
                                                                     java.lang.String suffix,
                                                                     java.util.Locale... locales)
Elaborates a list of localized filenames to check, from more to less specific. E.g.: fullname="myprops", locale="es_ES", defaultLocale="en_US" will return the following files: myprops_es_ES myprops_es myprops_en_US myprops_en myprops

Parameters:
prefix - the prefix of the filename
suffix - the suffix to apply after the locale, e.g. ".properties"