- java.lang.Object
-
- ilusr.core.i18n.LanguageManager
-
public class LanguageManager extends Object
- Author:
- Jeff Riggle
-
-
Constructor Summary
Constructors Constructor Description LanguageManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addLanguageChangeListener(Runnable listener)
void
addLanguagePack(File languageFile)
Adds a language file to the current language manager.void
addLanguagePack(String content)
Adds a language file to the current language manager.String
currentLanguage()
static LanguageManager
getInstance()
String
getValue(String key)
void
removeLanguageChangeListener(Runnable listener)
void
removeLanguagePack(String languageCode)
void
setLanguage(String language)
-
-
-
Method Detail
-
getInstance
public static LanguageManager getInstance()
- Returns:
- A @see LanguageManager instance
-
addLanguagePack
public void addLanguagePack(File languageFile) throws IOException
Adds a language file to the current language manager. Language files must have a language code.LanguageCode;=;en-US
Language files must also have values delimited by ;=;- Parameters:
languageFile
- The file to load and parse.- Throws:
IOException
-
addLanguagePack
public void addLanguagePack(String content)
Adds a language file to the current language manager. Language files must have a language code.LanguageCode;=;en-US
Language files must also have values delimited by ;=;- Parameters:
content
- The file content to load and parse.
-
removeLanguagePack
public void removeLanguagePack(String languageCode)
- Parameters:
languageCode
- The language to remove.
-
setLanguage
public void setLanguage(String language)
- Parameters:
language
- Sets the current language code.
-
currentLanguage
public String currentLanguage()
- Returns:
- Gets the current language code.
-
addLanguageChangeListener
public void addLanguageChangeListener(Runnable listener)
- Parameters:
listener
- A @see Runnable to call when the language code is changed.
-
removeLanguageChangeListener
public void removeLanguageChangeListener(Runnable listener)
- Parameters:
listener
- A @see Runnable to call when the language code is changed.
-
-