| Constructor and Description |
|---|
TranslationMessage() |
| Modifier and Type | Method and Description |
|---|---|
VIPCfg |
getCfg() |
java.lang.String |
getString(java.util.Locale locale,
java.lang.String component,
java.lang.String key,
java.lang.String source,
java.lang.String comment,
java.lang.Object... args)
get a translation under the component of the configured product
|
java.lang.String |
getString2(java.lang.String component,
java.lang.String bundle,
java.util.Locale locale,
java.lang.String key,
java.lang.Object... args)
get one translation of the configured product from VIP, if message not
found will get the English message from specified bundle.
|
java.util.Map<java.lang.String,java.lang.String> |
getStrings(java.util.Locale locale,
java.lang.String component)
get one component's translations from VIP of the configured product
|
java.util.Map<java.util.Locale,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> |
getStrings(java.util.Set<java.util.Locale> locales,
java.util.Set<java.lang.String> components)
get multiple components' translations from VIP server
|
boolean |
isAvailable(java.lang.String component,
java.util.Locale locale)
check if the translations of specified component is available
|
boolean |
isAvailable(java.lang.String component,
java.lang.String key,
java.util.Locale locale)
check if one translation of specified key is available
|
boolean |
postString(java.util.Locale locale,
java.lang.String component,
java.lang.String key,
java.lang.String source,
java.lang.String comment)
post a source to remote VIP server
|
boolean |
postStrings(java.util.Locale locale,
java.lang.String component,
java.util.List<org.json.simple.JSONObject> sources)
post a set of sources to remote VIP server which is configured
|
void |
setCfg(VIPCfg cfg) |
public VIPCfg getCfg()
public void setCfg(VIPCfg cfg)
public java.lang.String getString(java.util.Locale locale,
java.lang.String component,
java.lang.String key,
java.lang.String source,
java.lang.String comment,
java.lang.Object... args)
locale - an object used to get the source's translationcomponent - defined on VIP service, it will be created automatically if
not existkey - identify the sourcesource - it's English source which will be return if no translation
availablecomment - used to describe the source to help understand the source for
the translators.args - used to format the message with placeholder, it's not required
if the message doesn't contain any placeholderpublic boolean postStrings(java.util.Locale locale,
java.lang.String component,
java.util.List<org.json.simple.JSONObject> sources)
locale - currently no matter which locale it is, all sources will be
considered as Englishcomponent - the component name used to categorize the sources and
auto-created first timesources - the JSONObject should contain three attributes(key, source,
commentForSource).public boolean postString(java.util.Locale locale,
java.lang.String component,
java.lang.String key,
java.lang.String source,
java.lang.String comment)
locale - an object used to get the source's translationcomponent - defined on VIP service, it will be created automatically if
not existkey - identify the sourcesource - it's English source which will be return if no translation
availablecomment - used to describe the source to help understand the source for
the translators.public java.util.Map<java.lang.String,java.lang.String> getStrings(java.util.Locale locale,
java.lang.String component)
locale - a language tag to get the translationscomponent - defined on VIP service, it will be created automatically if
not existpublic java.util.Map<java.util.Locale,java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>> getStrings(java.util.Set<java.util.Locale> locales,
java.util.Set<java.lang.String> components)
locales - locales to get the translations of themcomponents - names of the components to get translationpublic java.lang.String getString2(java.lang.String component,
java.lang.String bundle,
java.util.Locale locale,
java.lang.String key,
java.lang.Object... args)
component - defined on VIP service, it will be created automatically if
not existbundle - properties file name, normally it should be put under the root
'src' pathlocale - an object used to get the source's translationkey - identify the sourceargs - used to format the message with placeholder, it's not required
if the message doesn't contain any placeholderpublic boolean isAvailable(java.lang.String component,
java.util.Locale locale)
component - locale - public boolean isAvailable(java.lang.String component,
java.lang.String key,
java.util.Locale locale)
component - locale -