public class JavacMessages extends Object implements Messages
This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
Modifier and Type | Field and Description |
---|---|
static Context.Key<JavacMessages> |
messagesKey
The context key for the JavacMessages object.
|
Constructor and Description |
---|
JavacMessages() |
JavacMessages(Context context)
Creates a JavacMessages object.
|
JavacMessages(String bundleName)
Creates a JavacMessages object.
|
JavacMessages(String bundleName,
Locale locale)
Creates a JavacMessages object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String bundleName)
Add a new resource bundle to the list that is searched for localized messages.
|
List<ResourceBundle> |
getBundles(Locale locale) |
Locale |
getCurrentLocale() |
static ResourceBundle |
getDefaultBundle() |
String |
getLocalizedString(Locale l,
String key,
Object... args)
Get a localized formatted string.
|
String |
getLocalizedString(String key,
Object... args)
Gets the localized string corresponding to a key, formatted with a set of args.
|
static JavacMessages |
instance(Context context)
Get the JavacMessages instance for this context.
|
void |
setCurrentLocale(Locale locale) |
public static final Context.Key<JavacMessages> messagesKey
public JavacMessages(Context context)
public JavacMessages(String bundleName) throws MissingResourceException
bundleName
- the name to identify the resource bundle of localized messages.MissingResourceException
public JavacMessages(String bundleName, Locale locale) throws MissingResourceException
bundleName
- the name to identify the resource bundle of localized messages.MissingResourceException
public JavacMessages() throws MissingResourceException
MissingResourceException
public static JavacMessages instance(Context context)
public Locale getCurrentLocale()
public void setCurrentLocale(Locale locale)
public void add(String bundleName) throws MissingResourceException
Messages
add
in interface Messages
bundleName
- the name to identify the resource bundle of localized messages.MissingResourceException
- if the given resource is not foundpublic List<ResourceBundle> getBundles(Locale locale)
public String getLocalizedString(String key, Object... args)
public String getLocalizedString(Locale l, String key, Object... args)
Messages
getLocalizedString
in interface Messages
l
- locale in which the text is to be localizedkey
- locale-independent message keyargs
- misc message argumentspublic static ResourceBundle getDefaultBundle()
Copyright © 2015. All rights reserved.