Package overit.geocall.lang
Class Dictionary
java.lang.Object
overit.geocall.lang.Dictionary
This class implements the object that manages the storing and conversion of the string translations
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDictionary(String lang, String layer, Long factory) Creates the dictionary.
It instantiates theChapterfor the standard module (geocall) and the custom applicative modules -
Method Summary
Modifier and TypeMethodDescriptionTranslates the string passed as parameter, searching for the translations first in the custom chapters and then in the standard one.booleanexists()Gets if the language has been found or not.Find all the dictionary's translations that match a pattern passed in input.static DictionaryExtracts the dictionary starting from the language, the applicative packages and the company.
If the dictionary does not exist, it is instantiated.static Dictionaryget(TeacherDuty teacherDuty) Extracts the dictionary starting from the teacher duty.
If the dictionary does not exist, it is instantiated.Chapter[]Returns theChapterthat contains the translations for the standard module (geocall)Returns the company ID for which the dictionary is writtengetLang()Returns the language with which the dictionary is written
-
Field Details
-
_lang
The language with which the dictionary is written -
_factory
The company ID for which the dictionary is written -
chapters
TheChapterthat contains the translations for the standard module (geocall) -
chapterChain
-
-
Constructor Details
-
Dictionary
Creates the dictionary.
It instantiates theChapterfor the standard module (geocall) and the custom applicative modules- Parameters:
lang- The languagelayer- The name of the layerfactory- The id of the company
-
-
Method Details
-
get
Extracts the dictionary starting from the language, the applicative packages and the company.
If the dictionary does not exist, it is instantiated.- Parameters:
lang- The languagelayer- The name of the layerfactory- The id of the company- Returns:
- The instance of the dictionary
-
get
Extracts the dictionary starting from the teacher duty.
If the dictionary does not exist, it is instantiated.- Parameters:
teacherDuty- the TeacherDuty instance- Returns:
- The instance of the dictionary
-
getLang
Returns the language with which the dictionary is written- Returns:
- The language, that corresponds to the name of the Dictionary
-
getFactory
Returns the company ID for which the dictionary is written- Returns:
- The company ID for which the dictionary is written
-
exists
public boolean exists()Gets if the language has been found or not.- Returns:
trueif the language has been found, false otherwisefalse
-
convert
Translates the string passed as parameter, searching for the translations first in the custom chapters and then in the standard one. If there isn't the translation for the string, it register the omission withOmission.logOmission(java.lang.String)- Parameters:
source- The string to translateomissions- TheOmissionused to record the missing translations- Returns:
- The translated string, or
nullif there isn't a translation
-
find
public TreeMap<String,String> find(String pattern, String type, boolean searchOnKeys, boolean searchOnValues) Find all the dictionary's translations that match a pattern passed in input.- Parameters:
pattern- The pattern to matchtype- The type of match.P (Phrase)means that the translation's key or value, must contains the entire pattern string to be retrieved.W (Words)means that the translation's key or value, must contains at least one of the words present within the pattern.searchOnKeys-trueif you want to search on the translations's keys,falseotherwise.searchOnValues-trueif you want to search on the translations's values,falseotherwise.- Returns:
- All the dictionary's translations that match a pattern passed in input.
-
getChapters
Returns theChapterthat contains the translations for the standard module (geocall)- Returns:
- The
Chapterthat contains the translations for the standard module (geocall)
-