public class GetText
extends java.lang.Object
add(PoFile) to add translations.Locale is set to Locale.ENGLISH. This can be changed via setLocale(Locale)| Constructor and Description |
|---|
GetText() |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(PoFile poFile)
Loads a
PoFile for translation usage. |
static TranslationEntry |
getTranslationEntry(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText)
Returns the underlying
TranslationEntry for a specific msgid |
static void |
setLocale(java.util.Locale locale)
Sets the default
Locale |
static java.lang.String |
tr(java.util.Locale locale,
java.lang.String sourceText)
Same as
tr(String) using a specific Locale |
static java.lang.String |
tr(java.util.Locale locale,
java.lang.String sourceText,
java.lang.Object... values)
Same as
tr(String, Object...) using a specific Locale |
static java.lang.String |
tr(java.lang.String sourceText)
Translates source based on currently set
Locale |
static java.lang.String |
tr(java.lang.String sourceText,
java.lang.Object... values)
Translates source based on currently set
Locale and injects values into the text |
static java.lang.String |
trc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText)
Same as
trc(String, String) using a specific Locale |
static java.lang.String |
trc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText,
java.lang.Object... values)
Same as
trc(String, String, Object...) using a specific Locale |
static java.lang.String |
trc(java.lang.String context,
java.lang.String sourceText)
Translates source based on currently set
Locale based on a specified context |
static java.lang.String |
trc(java.lang.String context,
java.lang.String sourceText,
java.lang.Object... values)
Translates source based on currently set
Locale based on a specified context and injects values into the text |
static java.lang.String |
trn(java.util.Locale locale,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
Same as
trn(String, String, int) using a specific Locale |
static java.lang.String |
trn(java.util.Locale locale,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
Same as
trn(String, String, int, Object...) using a specific Locale |
static java.lang.String |
trn(java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
Translates the plural form of a source based on currently set
Locale |
static java.lang.String |
trn(java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
Translates the plural form of a source based on currently set
Locale and injects values into the text |
static java.lang.String |
trnc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
Same as
trnc(String, String, String, int) using a specific Locale |
static java.lang.String |
trnc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
Same as
trnc(String, String, String, int, Object...) using a specific Locale |
static java.lang.String |
trnc(java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
Translates the plural form of a source based on currently set
Locale based on a specified context |
static java.lang.String |
trnc(java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
Translates the plural form of a source based on currently set
Locale based on a specified context and injects values into the text |
public static java.lang.String tr(java.lang.String sourceText)
LocalesourceText - The source text to translate (msgid)public static java.lang.String tr(java.lang.String sourceText,
java.lang.Object... values)
Locale and injects values into the textsourceText - The source text to translate (msgid)values - The values to be injected using MessageFormatpublic static java.lang.String trc(java.lang.String context,
java.lang.String sourceText)
Locale based on a specified contextcontext - The translation context (msgctxt)sourceText - The source text to translate (msgid)public static java.lang.String trc(java.lang.String context,
java.lang.String sourceText,
java.lang.Object... values)
Locale based on a specified context and injects values into the textcontext - The translation context (msgctxt)sourceText - The source text to translate (msgid)values - The values to be injected using MessageFormatpublic static java.lang.String trn(java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
LocalesourceText - The source text to translate (msgid)sourcePluralText - The plural source text to translate (msgid_plural)n - The plural index (msgstr[n])public static java.lang.String trn(java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
Locale and injects values into the textsourceText - The source text to translate (msgid)sourcePluralText - The plural source text to translate (msgid_plural)n - The plural index (msgstr[n])values - The values to be injected using MessageFormatpublic static java.lang.String trnc(java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
Locale based on a specified contextcontext - The translation context (msgctxt)sourceText - The source text to translate (msgid)sourcePluralText - The plural source text to translate (msgid_plural)n - The plural index (msgstr[n])public static java.lang.String trnc(java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
Locale based on a specified context and injects values into the textcontext - The translation context (msgctxt)sourceText - The source text to translate (msgid)sourcePluralText - The plural source text to translate (msgid_plural)n - The plural index (msgstr[n])values - The values to be injected using MessageFormatpublic static java.lang.String tr(java.util.Locale locale,
java.lang.String sourceText)
tr(String) using a specific Localepublic static java.lang.String tr(java.util.Locale locale,
java.lang.String sourceText,
java.lang.Object... values)
tr(String, Object...) using a specific Localepublic static java.lang.String trc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText)
trc(String, String) using a specific Localepublic static java.lang.String trc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText,
java.lang.Object... values)
trc(String, String, Object...) using a specific Localepublic static java.lang.String trn(java.util.Locale locale,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
trn(String, String, int) using a specific Localepublic static java.lang.String trn(java.util.Locale locale,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
trn(String, String, int, Object...) using a specific Localepublic static java.lang.String trnc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n)
trnc(String, String, String, int) using a specific Localepublic static java.lang.String trnc(java.util.Locale locale,
java.lang.String context,
java.lang.String sourceText,
java.lang.String sourcePluralText,
int n,
java.lang.Object... values)
trnc(String, String, String, int, Object...) using a specific Localepublic static TranslationEntry getTranslationEntry(java.util.Locale locale, java.lang.String context, java.lang.String sourceText)
TranslationEntry for a specific msgidlocale - The Locale to look upcontext - Null if default context should be used, or, msgctxtsourceText - The source text to translate (msgid)public static void add(PoFile poFile)
PoFile for translation usage.
Note: This does not need to match the current LocalepoFile - A PoFile instancepublic static void setLocale(java.util.Locale locale)
Localelocale - The Locale to use