org.crosswire.common.util
Class Translations

java.lang.Object
  extended by org.crosswire.common.util.Translations

public final class Translations
extends Object

Translations provides a list of locales that BibleDesktop has been translated into.

Author:
DM Smith
See Also:
The GNU Lesser General Public License for details.

Field Summary
static Locale DEFAULT_LOCALE
          The default Locale, it the user has not chosen anything else.
static String DEFAULT_TRANSLATION
          The default translation, if the user has not chosen anything else.
private static Translations instance
           
private static org.slf4j.Logger log
          The log stream
private static Locale originalLocale
          The locale that the program starts with.
private  String translation
          The translation that BibleDesktop should use.
private static String TRANSLATION_KEY
          The key used in config.xml
private  String[] translations
          List of available translations.
 
Constructor Summary
private Translations()
          Singleton classes have private constructors.
 
Method Summary
 String getCurrent()
          Get the current translation as a human readable string.
 Locale getCurrentLocale()
          Get the locale for the current translation.
static String getCurrentTranslation()
          Get the current translation as a human readable string.
 PropertyMap getSupported()
          Gets a listing of all the translations that Bible Desktop supports.
static Map<String,String> getSupportedTranslations()
          Gets a listing of all the translations that Bible Desktop supports.
static Translations instance()
          All access to Translations is through this single instance.
private  void loadSupportedTranslations()
          Get a list of the supported translations
 void register()
          Register this class with the common config engine.
 void setCurrent(String newTranslation)
          Set the current translation, using human readable string.
static void setCurrentTranslation(String newTranslation)
          Set the current translation, using human readable string.
 void setLocale()
          Set the locale for the program to the one the user has selected.
 String toString(String translationCode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANSLATION_KEY

private static final String TRANSLATION_KEY
The key used in config.xml

See Also:
Constant Field Values

DEFAULT_TRANSLATION

public static final String DEFAULT_TRANSLATION
The default translation, if the user has not chosen anything else.

See Also:
Constant Field Values

DEFAULT_LOCALE

public static final Locale DEFAULT_LOCALE
The default Locale, it the user has not chosen anything else.


translation

private String translation
The translation that BibleDesktop should use.


translations

private String[] translations
List of available translations.


originalLocale

private static Locale originalLocale
The locale that the program starts with. This needs to precede "instance."


instance

private static Translations instance

log

private static final org.slf4j.Logger log
The log stream

Constructor Detail

Translations

private Translations()
Singleton classes have private constructors.

Method Detail

instance

public static Translations instance()
All access to Translations is through this single instance.

Returns:
the singleton instance

getSupported

public PropertyMap getSupported()
Gets a listing of all the translations that Bible Desktop supports.

Returns:
an string array of translations in locale friendly names.

getCurrentLocale

public Locale getCurrentLocale()
Get the locale for the current translation.

Returns:
the translation's locale

getCurrent

public String getCurrent()
Get the current translation as a human readable string.

Returns:
the current translation

setCurrent

public void setCurrent(String newTranslation)
Set the current translation, using human readable string.

Parameters:
newTranslation - the translation to use

setLocale

public void setLocale()
Set the locale for the program to the one the user has selected. But don't set it to the default translation, so that the user's actual locale, is used for Bible book names. This only makes sense after config has called setCurrentTranslation.


register

public void register()
Register this class with the common config engine.


getCurrentTranslation

public static String getCurrentTranslation()
Get the current translation as a human readable string.

Returns:
the current translation

setCurrentTranslation

public static void setCurrentTranslation(String newTranslation)
Set the current translation, using human readable string.

Parameters:
newTranslation - the translation to use

getSupportedTranslations

public static Map<String,String> getSupportedTranslations()
Gets a listing of all the translations that Bible Desktop supports.

Returns:
an string array of translations in locale friendly names.

loadSupportedTranslations

private void loadSupportedTranslations()
Get a list of the supported translations


toString

public String toString(String translationCode)

Copyright ยจ 2003-2015