Package com.transifex.common
Class LocaleData.TranslationMap
java.lang.Object
com.transifex.common.LocaleData.TranslationMap
- Enclosing class:
- LocaleData
A class that holds translations for multiple locales. It maps locale codes to
LocaleData.LocaleStrings
objects.-
Constructor Summary
ConstructorDescriptionTranslationMap
(int initialCapacity) Constructs an emptyTranslationMap
with the specified initial capacity.TranslationMap
(LocaleData.TranslationMap translationMap) Creates a new TranslationMap object by making a copy of the provided one.Creates a TranslationMap object which uses the providedHashMap
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return theLocaleStrings
object associated with the provided locale, ornull
if it isn't found.Returns aSet
with the locales supported by theTranslationMap
.int
hashCode()
boolean
isEmpty()
Returnstrue
if the object contains no locale to LocaleStrings mappings.void
put
(String locale, LocaleData.LocaleStrings localeStrings) Associates the specified locale with the specifiedLocaleData.LocaleStrings
object.toString()
-
Constructor Details
-
TranslationMap
public TranslationMap(int initialCapacity) Constructs an emptyTranslationMap
with the specified initial capacity.- Parameters:
initialCapacity
- The initial capacity. Set to the number of expected locales.
-
TranslationMap
Creates a TranslationMap object which uses the providedHashMap
.The HashMap should map locale codes to
LocaleData.LocaleStrings
like this:{ 'fr' : LocaleStrings, 'de' : LocaleStrings, 'el' : LocaleStrings, }
-
TranslationMap
Creates a new TranslationMap object by making a copy of the provided one.
-
-
Method Details
-
put
Associates the specified locale with the specifiedLocaleData.LocaleStrings
object. -
get
Return theLocaleStrings
object associated with the provided locale, ornull
if it isn't found. -
getLocales
Returns aSet
with the locales supported by theTranslationMap
. -
isEmpty
public boolean isEmpty()Returnstrue
if the object contains no locale to LocaleStrings mappings.- Returns:
true
if it's empty,false
otherwise.
-
toString
-
equals
-
hashCode
public int hashCode()
-