org.objectledge.i18n
Interface I18n

All Known Implementing Classes:
AbstractI18n, XMLI18n

public interface I18n

Common interface for i18n various i18n implementations.

Version:
$Id: I18n.java,v 1.14 2006/03/23 09:54:54 pablo Exp $
Author:
Pawel Potempski, Damian Gajda

Method Summary
 boolean defined(Locale locale, String key)
          Checks if a string value is defined for a given locale.
 boolean defined(String key)
          Checks if a string value is defined for a default locale.
 String get(Locale locale, String key)
          Get the string value.
 String get(Locale locale, String key, List<String> values)
          Get the string and replace $[1..n] variables with given values.
 String get(Locale locale, String key, String... values)
          Get the string and replace $[1..n] variables with given values.
 String get(Locale locale, String key, String defaultValue)
          Get the string value with given default value if the string is missing in both given and default locale.
 Locale getDefaultLocale()
          Returns configured default locale.
 Collection<String> getKeys(Locale locale)
          Get all keys defined for given locale.
 String getLocaleName(Locale locale)
          Returns the human readable name of the given locale.
 Locale getPreferedLocale()
          Returns configured prefered locale.
 Locale[] getSupportedLocales()
          Returns configured locales.
 void reload()
          Reload the localization.
 

Method Detail

getDefaultLocale

Locale getDefaultLocale()
Returns configured default locale.

Returns:
the default locale object.

getPreferedLocale

Locale getPreferedLocale()
Returns configured prefered locale.

Returns:
the prefered locale object.

getSupportedLocales

Locale[] getSupportedLocales()
Returns configured locales.

Returns:
an array of defined locale.

getLocaleName

String getLocaleName(Locale locale)
Returns the human readable name of the given locale.

Parameters:
locale - the locale.
Returns:
the human readable name of the given locale.

defined

boolean defined(String key)
Checks if a string value is defined for a default locale.

Parameters:
key - the key.
Returns:
true if the string is defined

defined

boolean defined(Locale locale,
                String key)
Checks if a string value is defined for a given locale.

Parameters:
locale - the locale.
key - the key.
Returns:
true if the string is defined

get

String get(Locale locale,
           String key)
Get the string value.

Parameters:
locale - the locale.
key - the key.
Returns:
the string value.

get

String get(Locale locale,
           String key,
           String defaultValue)
Get the string value with given default value if the string is missing in both given and default locale.

Parameters:
locale - the locale.
key - the key.
defaultValue - the default value in case key mapping is missing.
Returns:
the string value.

get

String get(Locale locale,
           String key,
           String... values)
Get the string and replace $[1..n] variables with given values.

Parameters:
locale - the locale.
key - the key.
values - the values use for substitution.
Returns:
the the output string.

get

String get(Locale locale,
           String key,
           List<String> values)
Get the string and replace $[1..n] variables with given values.

Parameters:
locale - the locale.
key - the key.
values - the values use for substitution.
Returns:
the the output string.

getKeys

Collection<String> getKeys(Locale locale)
Get all keys defined for given locale.

Parameters:
locale - the locale.
Returns:
the list of keys.

reload

void reload()
Reload the localization.



Copyright © 2003-2006 objectledge.org. All Rights Reserved.