com.ecyrd.jspwiki.i18n
Class SilverpeasWikiInternationalizationManager

java.lang.Object
  extended by com.ecyrd.jspwiki.i18n.InternationalizationManager
      extended by com.ecyrd.jspwiki.i18n.SilverpeasWikiInternationalizationManager

public class SilverpeasWikiInternationalizationManager
extends com.ecyrd.jspwiki.i18n.InternationalizationManager

Manages all internationalization in JSPWiki.

Author:
Ludovic Bertin

Field Summary
 
Fields inherited from class com.ecyrd.jspwiki.i18n.InternationalizationManager
CORE_BUNDLE
 
Constructor Summary
SilverpeasWikiInternationalizationManager(com.ecyrd.jspwiki.WikiEngine engine)
          Constructs a new InternationalizationManager.
 
Method Summary
 String get(String key)
          Returns a String from the CORE_BUNDLE using English as the default locale.
 String get(String bundle, Locale locale, String key)
          If you are too lazy to open your own bundle, use this method to get a string simply from a bundle.
 ResourceBundle getBundle(String bundle, Locale locale)
          Finds a resource bundle.
static Locale getLocale()
           
static void setPreferredLanguage(String newLanguage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SilverpeasWikiInternationalizationManager

public SilverpeasWikiInternationalizationManager(com.ecyrd.jspwiki.WikiEngine engine)
Constructs a new InternationalizationManager.

Parameters:
engine - To which engine this belongs to
Method Detail

setPreferredLanguage

public static void setPreferredLanguage(String newLanguage)

getLocale

public static Locale getLocale()

get

public String get(String key)
           throws MissingResourceException
Returns a String from the CORE_BUNDLE using English as the default locale.

Overrides:
get in class com.ecyrd.jspwiki.i18n.InternationalizationManager
Parameters:
key - Key to find
Returns:
The English string
Throws:
MissingResourceException - If there is no such key

getBundle

public ResourceBundle getBundle(String bundle,
                                Locale locale)
                         throws MissingResourceException
Finds a resource bundle.

Overrides:
getBundle in class com.ecyrd.jspwiki.i18n.InternationalizationManager
Parameters:
bundle - The ResourceBundle to find. Must exist.
locale - The Locale to use. Set to null to get the default locale.
Returns:
A localized string
Throws:
MissingResourceException - If the key cannot be located at all, even from the default locale.

get

public String get(String bundle,
                  Locale locale,
                  String key)
           throws MissingResourceException
If you are too lazy to open your own bundle, use this method to get a string simply from a bundle.

Overrides:
get in class com.ecyrd.jspwiki.i18n.InternationalizationManager
Parameters:
bundle - Which bundle the string is in
locale - Locale to use - null for default
key - Which key to use.
Returns:
A localized string (or from the default language, if not found)
Throws:
MissingResourceException - If the key cannot be located at all, even from the default locale.


Copyright © 2016 Silverpeas. All Rights Reserved.