Class Locale
- java.lang.Object
-
- ch.sahits.game.openpatrician.utilities.l10n.Locale
-
@Component public class Locale extends java.lang.Object
Representation of the current used Locale for translation. This class is thread safe.- Author:
- Andi Hotz, (c) Sahits GmbH, 2011 Created on Jan 9, 2011
-
-
Field Summary
Fields Modifier and Type Field Description private GamePropertyUtility
gamePropertyUtility
Game properties utility used for loading the localeprivate java.util.Locale
l
Reference the real local that is used by the Java APIprivate java.util.Locale[]
supportedLocales
List of supported locals
-
Constructor Summary
Constructors Constructor Description Locale()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Locale
getCurrentLocal()
Retrieve the currently set localejava.util.Locale[]
getSupportedLocales()
Retrieve an array of all supported localesprivate void
initLocale()
Loading and setting the game localevoid
setLocale(java.util.Locale locale)
Set a new locale.
-
-
-
Field Detail
-
gamePropertyUtility
@Autowired private GamePropertyUtility gamePropertyUtility
Game properties utility used for loading the locale
-
l
private java.util.Locale l
Reference the real local that is used by the Java API
-
supportedLocales
private final java.util.Locale[] supportedLocales
List of supported locals
-
-
Method Detail
-
initLocale
@PostConstruct private void initLocale()
Loading and setting the game locale
-
getCurrentLocal
public java.util.Locale getCurrentLocal()
Retrieve the currently set locale- Returns:
- java.util.Locale
-
getSupportedLocales
public java.util.Locale[] getSupportedLocales()
Retrieve an array of all supported locales- Returns:
- array of supported java.util.Locale
-
setLocale
public void setLocale(java.util.Locale locale)
Set a new locale. The locale must be one of the supported ones.- Parameters:
locale
- java.util.Locale
-
-