public class Language extends java.lang.Object implements Translator
Translator.SourceLanguage
Modifier and Type | Field and Description |
---|---|
static java.lang.Integer |
currLanguageIndex
The currently selected language index of the dictionary-file, which is used in the application
|
static java.lang.String |
DE
Constant for German
|
static java.lang.String |
EN
Constant for English
|
static java.lang.String |
ES
Constant for Spanish
|
static java.lang.String |
FR
Constant for French
|
static java.lang.String |
IT
Constant for Italian
|
static java.lang.String |
seperator
This is the separator used in the dictionary file
|
static java.lang.String |
SOURCE_LANG
The header for the first column (index=0) of the dictionary
|
Modifier and Type | Method and Description |
---|---|
static void |
changeApplicationLanguageTo(java.lang.String newLang)
Changing the application language to: newLang
=> "DE", "EN", "IT", "ES" or "FR"
|
static void |
delete(java.lang.String expression)
Remove this line from the dictionary
(put an empty line)
|
java.lang.String |
dynamicTranslate(java.lang.String expression)
Has to translate the specified input.
|
java.lang.String |
dynamicTranslate(java.lang.String expression,
Translator.SourceLanguage sourceLanguage)
Has to translate the specified input, where the second parameter
describes the source language in which the input is given.
|
static java.util.List<java.lang.String> |
getDictLineList() |
static int |
getIndexOfLanguage(java.lang.String language)
Returns the index of the dictionary column which provides the language
given by the parameter language.
|
static Language |
getInstance()
Returns the instance of this Singleton-Class
|
static java.lang.String |
getLanguageName(java.lang.String langHeader)
Translate the already known language-headers (e. g.
|
static java.lang.String[] |
getLanguages()
List all available Language-Headers from the
Dictionary file as String-Array
|
static java.lang.String[] |
getLanguages(boolean remove_LANG_SOURCE)
List all available Language-Headers from the
Dictionary file as String-Array
|
static boolean |
isCurrentLanguage(java.lang.String language)
Returns true if the language, given by the parameter language, is the current one
|
static void |
reStartDictionary()
Restarts the dictionary.
|
static boolean |
saveDictionaryFile()
Saving the file 'dictionary.csv' to the folder properties
|
static void |
startDictionary()
This method has to be invoked only once in order to prepare the translation
functionalities.
|
static java.lang.String |
translate(java.lang.String deExpression)
Translate one expression, which is based on a German expression
|
static java.lang.String |
translate(java.lang.String expression,
java.lang.String language)
Translate one expression, which is based on the language specified through
the second parameter language (use one of the languages specified as static
attribute in this class e.g.
|
static void |
update(java.lang.String expression,
java.lang.String dictRow)
Update this line of the dictionary
|
static void |
useCSVDictionaryFile()
This method can be used in order to change the source dictionary file of the application
to the CSV-dictionary file located at '/properties/dictionary.csv'
The idea is to make the translation also in other applications, as for example in MS Excel
|
public static final java.lang.String DE
public static final java.lang.String EN
public static final java.lang.String IT
public static final java.lang.String ES
public static final java.lang.String FR
public static final java.lang.String seperator
public static final java.lang.String SOURCE_LANG
public static java.lang.Integer currLanguageIndex
public static Language getInstance()
public static void startDictionary()
public static void reStartDictionary()
public static void changeApplicationLanguageTo(java.lang.String newLang)
newLang
- public java.lang.String dynamicTranslate(java.lang.String expression)
Translator
dynamicTranslate
in interface Translator
expression
- the expression to translatepublic java.lang.String dynamicTranslate(java.lang.String expression, Translator.SourceLanguage sourceLanguage)
Translator
dynamicTranslate
in interface Translator
expression
- the expression to translatesourceLanguage
- the source languagepublic static java.lang.String translate(java.lang.String deExpression)
public static java.lang.String translate(java.lang.String expression, java.lang.String language)
expression
- language
- => take one of these parameters: Language.EN, Language.DE and so onpublic static java.lang.String[] getLanguages()
public static java.lang.String[] getLanguages(boolean remove_LANG_SOURCE)
public static java.lang.String getLanguageName(java.lang.String langHeader)
public static int getIndexOfLanguage(java.lang.String language)
language
- (e. g. Language.IT)public static boolean isCurrentLanguage(java.lang.String language)
language
- public static void useCSVDictionaryFile()
public static boolean saveDictionaryFile()
public static java.util.List<java.lang.String> getDictLineList()
public static void update(java.lang.String expression, java.lang.String dictRow)
expression
- dictRow
- public static void delete(java.lang.String expression)
expression
-