This project has retired. For details please refer to its Attic page.
LocaleUtil (Tiles 2 2.2.2 API)

org.apache.tiles.util
Class LocaleUtil

Package class diagram package LocaleUtil
java.lang.Object
  extended by org.apache.tiles.util.LocaleUtil

public final class LocaleUtil
extends 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 Locale NULL_LOCALE
          The "null" Locale, i.e. a Locale that points to no real locale.
 
Method Summary
static String calculatePostfix(Locale locale)
          Calculate the postfix to append to a filename to load the correct single filename for that Locale.
static List<String> calculatePostfixes(Locale locale)
          Calculate the postfixes along the search path from the base bundle to the bundle specified by baseName and locale.
static String concatPostfix(String name, String postfix)
          Concat postfix to the name.
static Locale getParentLocale(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 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 List<String> calculatePostfixes(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 String calculatePostfix(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 String concatPostfix(String name,
                                   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 Locale getParentLocale(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.


Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.