public final class Translations
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static Translations |
FALSE
Known translations of "false".
|
static Translations |
NO
Known translations of "no".
|
static Translations |
OFF
Known translations of "off".
|
static Translations |
ON
Known translations of "on".
|
static Translations |
TRUE
Known translations of "true".
|
static Translations |
YES
Known translations of "yes".
|
Constructor and Description |
---|
Translations()
Create a new Translations object with only a default set to the empty
string.
|
Translations(java.lang.String defaultValue)
Create a new Translations object with the default set to the specified
string.
|
Modifier and Type | Method and Description |
---|---|
java.util.Locale |
closestDefined(java.util.Locale locale)
The closest locale defined for the specified locale
|
Translations |
copy()
Makes a copy of the specified translation
|
boolean |
equals(java.lang.Object o)
compare two Translations for equality
|
java.lang.String |
getDebugString()
return a string representation of the Locale, useful for debugging
|
java.lang.String |
getDefault()
Return the default translation.
|
java.lang.String[] |
getLocaleNames()
Return all of the locale names for which a translation exists.
|
java.util.Locale[] |
getLocales()
Return all of the locales for which a translation exists.
|
java.lang.String |
getTranslation(java.util.Locale locale)
Return the translation for the specified locale.
|
java.lang.String |
getTranslation(java.lang.String locale)
Return the translation for the specified locale.
|
int |
hashCode()
returns a unique hash for this instance
|
boolean |
isEqualTo(Translations other)
compares two translations
|
static java.util.Locale |
parseLocale(java.lang.String pattern)
Parse the locale pattern and return the corresponding locale.
|
void |
removeLocale(java.util.Locale locale)
Remove the translation for the specified locale.
|
void |
removeLocale(java.lang.String locale)
Remove this the translation for the specified locale.
|
void |
setDefault(java.lang.String value)
Change the default translation.
|
java.lang.String |
setTranslation(java.util.Locale locale,
java.lang.String value)
Create or modify an existing translation.
|
java.lang.String |
setTranslation(java.lang.String locale,
java.lang.String value)
Create or modify an existing translation.
|
java.lang.String |
toString()
return a string representation of the Locale, useful for debugging
|
static java.lang.String |
toString(java.util.Locale locale)
Returns a string prepresentation of the specified locale.
|
java.lang.String |
translate()
Returns the most appropriate translation for this resource based on the
default locale.
|
java.lang.String |
translate(java.util.Locale locale)
Returns the most appropriate translation for this resource for the
specified locale.
|
java.lang.String |
translate(java.lang.String locale)
Returns the most appropriate translation for this resource for the
specified locale.
|
public static final Translations TRUE
public static final Translations FALSE
public static final Translations YES
public static final Translations NO
public static final Translations ON
public static final Translations OFF
public Translations()
public Translations(java.lang.String defaultValue)
defaultValue
- the default display name. May not be null.public java.lang.String getDefault()
public void setDefault(java.lang.String value)
value
- the new default translation, may not be null.public java.util.Locale[] getLocales()
public java.lang.String[] getLocaleNames()
public void removeLocale(java.util.Locale locale)
locale
- the locale to be removedpublic void removeLocale(java.lang.String locale)
locale
- the locale to be removedpublic java.lang.String setTranslation(java.util.Locale locale, java.lang.String value)
locale
- the locale for the new translationvalue
- the locale specific translationpublic java.lang.String setTranslation(java.lang.String locale, java.lang.String value)
locale
- the locale for the new translationvalue
- the locale specific translationpublic java.lang.String getTranslation(java.util.Locale locale)
locale
- the locale of the desired translation. May not be null.public java.lang.String getTranslation(java.lang.String locale)
locale
- the locale of the desired translation. May not be null.public java.lang.String translate(java.util.Locale locale)
locale
- the locale of the desired translation. A null value will
return the default translation.Translations.getDefault()
public java.util.Locale closestDefined(java.util.Locale locale)
locale
- the specified localepublic java.lang.String translate(java.lang.String locale)
locale
- the locale of the desired translation. A null value will
return the default translation.public java.lang.String translate()
Locale.getDefault()
public static java.lang.String toString(java.util.Locale locale)
locale
- the locale. A null parameter will return the empty string.public static java.util.Locale parseLocale(java.lang.String pattern)
pattern
- the locale pattern. A null pattern will return the "invariant"
locale (language="", country="", variant="")public java.lang.String getDebugString()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the other Translationpublic int hashCode()
hashCode
in class java.lang.Object
public boolean isEqualTo(Translations other)
other
- the other translationpublic Translations copy()
StarTeam SDK 17.0, Build 34
Copyright © 2019 Micro Focus or one of its affiliates. All rights reserved.