org.apache.tiles.util
Class LocaleUtil

java.lang.Object
  extended by org.apache.tiles.util.LocaleUtil

public final class LocaleUtil
extends java.lang.Object

Utilities for locale manipulation.

Since:
2.1.0
Version:
$Rev: 667964 $ $Date: 2008-06-15 17:00:54 +0200 (dom, 15 giu 2008) $

Field Summary
static java.util.Locale NULL_LOCALE
          The "null" Locale, i.e.
 
Method Summary
static java.lang.String calculatePostfix(java.util.Locale locale)
          Calculate the postfix to append to a filename to load the correct single filename for that Locale.
static java.util.List<java.lang.String> calculatePostfixes(java.util.Locale locale)
          Calculate the postfixes along the search path from the base bundle to the bundle specified by baseName and locale.
static java.lang.String concatPostfix(java.lang.String name, java.lang.String postfix)
          Concat postfix to the name.
static java.util.Locale getParentLocale(java.util.Locale locale)
           Returns the "parent" locale of a given locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_LOCALE

public static final java.util.Locale NULL_LOCALE
The "null" Locale, i.e. a Locale that points to no real locale.

Since:
2.1.0
Method Detail

calculatePostfixes

public static java.util.List<java.lang.String> calculatePostfixes(java.util.Locale locale)
Calculate the postfixes along the search path from the base bundle to the bundle specified by baseName and locale. Method copied from java.util.ResourceBundle

Parameters:
locale - The locale.
Returns:
a list of postfixes to add to filenames.
Since:
2.1.0

calculatePostfix

public static java.lang.String calculatePostfix(java.util.Locale locale)
Calculate the postfix to append to a filename to load the correct single filename for that Locale.

Parameters:
locale - The locale.
Returns:
The postfix to append to the filename.
Since:
2.1.0

concatPostfix

public static java.lang.String concatPostfix(java.lang.String name,
                                             java.lang.String postfix)
Concat postfix to the name. Take care of existing filename extension. Transform the given name "name.ext" to have "name" + "postfix" + "ext". If there is no ext, return "name" + "postfix".

Parameters:
name - Filename.
postfix - Postfix to add.
Returns:
Concatenated filename.
Since:
2.1.0

getParentLocale

public static java.util.Locale getParentLocale(java.util.Locale locale)

Returns the "parent" locale of a given locale.

If the original locale is only language-based, the NULL_LOCALE object is returned.

If the original locale is NULL_LOCALE, then null is returned.

Parameters:
locale - The original locale.
Returns:
The parent locale.