@Role
public interface LocalizationManager
Properties are looked for in several bundles
, in the order of their
priority
. The first translation found in one of these bundles is the one
returned. If the property is not found in any of these sources, then null is returned.
Modifier and Type | Method and Description |
---|---|
default Locale |
getDefaultLocale() |
Translation |
getTranslation(String key,
Locale locale)
Find a translation in the specified locale.
|
TranslationBundle |
getTranslationBundle(String bundleType,
String bundleId)
Find a bundle.
|
default String |
getTranslationPlain(String key,
Locale locale,
Object... parameters)
Find a translation in the current language.
|
void |
use(String bundleType,
String bundleId)
Registers a resource location as a possible localization bundle that should be used in the current execution.
|
Translation getTranslation(String key, Locale locale)
key
- the key identifying the message to look forlocale
- the Locale
for which this translation is searched. The result might me associated to a
different Locale
(for example getting the fr
translation when asking for the
fr_FR
one).LocalizationManager
default String getTranslationPlain(String key, Locale locale, Object... parameters)
key
- the key identifying the message to look forlocale
- the Locale
for which this translation is searched. The result might me associated to a
different Locale
(for example getting the fr
translation when asking for the
fr_FR
one).parameters
- the parametersgetTranslation(String, Locale)
TranslationBundle getTranslationBundle(String bundleType, String bundleId) throws TranslationBundleDoesNotExistsException, TranslationBundleFactoryDoesNotExistsException
bundleType
- a hint identifying the bundle type.bundleId
- the identifier of the bundle, for example a wiki document name, or the URL to a
.properties file.TranslationBundle
or null if none could be foundTranslationBundleDoesNotExistsException
- when no bundle could be found for the passed identifierTranslationBundleFactoryDoesNotExistsException
- when no bundle factory could be found for the passed typevoid use(String bundleType, String bundleId) throws TranslationBundleDoesNotExistsException, TranslationBundleFactoryDoesNotExistsException
bundleType
- a hint identifying the bundle type.bundleId
- the identifier of the bindle, for example a wiki document name, or the URL to a
.properties file.TranslationBundleDoesNotExistsException
- when no bundle could be found for the passed identifierTranslationBundleFactoryDoesNotExistsException
- when no bundle factory could be found for the passed typeCopyright © 2004–2022 XWiki. All rights reserved.