freemarker.template
Class LocaleUtil

java.lang.Object
  |
  +--freemarker.template.LocaleUtil

public class LocaleUtil
extends java.lang.Object

A holder for some locale-related routines.


Constructor Summary
LocaleUtil()
           
 
Method Summary
static java.lang.String getCharset(java.util.Locale loc)
          Gets the preferred charset for the given locale, or the default platform encoding if the locale is not in the table.
static char getDecimalSeparator(java.util.Locale loc)
           
static java.lang.String[] getFilenames(java.lang.String filename, java.util.Locale locale)
          Returns an array of potential filenames, given the base filename and the locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleUtil

public LocaleUtil()
Method Detail

getCharset

public static java.lang.String getCharset(java.util.Locale loc)
Gets the preferred charset for the given locale, or the default platform encoding if the locale is not in the table.
Parameters:
loc - the locale
Returns:
the preferred charset

getFilenames

public static java.lang.String[] getFilenames(java.lang.String filename,
                                              java.util.Locale locale)
Returns an array of potential filenames, given the base filename and the locale. For example, if the filename was foo.html and the locale was fr_CA, then this method would return [null, "foo_fr_CA.html", "foo_fr.html", "foo.html"] The first element is null, because no variant is defined.

getDecimalSeparator

public static char getDecimalSeparator(java.util.Locale loc)
Parameters:
loc - the locale
Returns:
the decimal separator for a locale, usually either '.' or ','