Class | Description |
---|---|
Errors |
Locale-dependent resources for error messages.
|
Errors.Keys |
Resource keys.
|
IndexedResourceBundle |
ResourceBundle implementation accepting integers instead of strings for resource keys. |
Messages |
Locale-dependent resources for miscellaneous (often logging) messages.
|
Messages.Keys |
Resource keys.
|
ResourceCompilerMojo |
Compiles the international resources that are found in the module from which this mojo is invoked.
|
Vocabulary |
Locale-dependent resources for single words or short sentences.
|
Vocabulary.Keys |
Resource keys.
|
Apache SIS resources are provided in binary files having the ".utf
" extension.
The resource keys are numeric constants declared in the Keys
static inner classes.
Values are strings which may optionally have slots for one or more parameters, identified
by the "{
n}
" characters sequences where n
is the parameter number (first parameter is "{0}
").
If, and only if, a string value has slots for at least one parameter, then:
'_'
character followed by the expected number of parameters;MessageFormat
syntax.Note:Apache SIS developers can add resources by editing thejava.util.Formatter
is an alternative toMessageFormat
providing similar functionalities with a C/C++ like syntax. HoweverMessageFormat
has two advantages: it provides achoice
format type (useful for handling plural forms), and localizes properly objects of unspecified type (by contrast, theFormatter
"%s"
type always invoketoString()
). The later advantage is important for messages in wich the same argument could receiveNumber
orDate
instances as well asString
. Furthermore, thejava.util.logging
framework is designed for use withMessageFormat
(see theFormatter.formatMessage(LogRecord)
method).
*.properties
file
in the source code directory, then run the localized resources compiler provided in the
sis-build-helper
module.
Developers shall not apply the MessageFormat
rules for using quotes,
since the resources compiler will apply itself the doubled single quotes when
necessary. This avoid the unfortunate confusion documented in the warning section of
MessageFormat
javadoc.
IndexedResourceBundle
subclasses provide a
getResources(Locale)
static method. It can be used for fetching localized strings
as below:
For convenience, allString text = TheBundle.getResources(locale).getString(key, optionalArguments);
IndexedResourceBundle
subclasses provide also various
format(int, …)
and formatInternational(int, …)
static methods for
fetching localized texts in the system
default locale, or localizable texts:
InternationalString i18n = TheBundle.formatInternational(key, optionalArguments); String text = i18n.toString(locale); // Equivalent to the above example. text = TheBundle.format(key, optionalArguments); // Uses the default locale.
ResourceBundle
,
MessageFormat
,
ResourceInternationalString
Defined in the sis-utility module
Copyright © 2010–2013 The Apache Software Foundation. All rights reserved.