Localization Plugin
This application is bundled with:
This plugin cannot currently be downloaded separately.
- XWiki Enteprise
This plugin cannot currently be downloaded separately.
Localization Plugin
The Localization Component is an efficient and flexible replacement of the old MessageTool class, which eases the deployment of XWiki applications. Localization here refers to translation; see the Wikipedia article about internationalization and localization for more details. In summary, this component allows applications and plugins to be translated into different languages.Features
- Efficient implementation by making intensive use of caching.
- Pluggable Bundle types, allowing developers to create and use new types of resources. At the moment bundles defined in wiki documents and in .properties files are supported. See http://java.sun.com/docs/books/tutorial/i18n/resbundle/index.html for more details on this type of files.
- Document bundles can be dynamically pulled in by user code (application documents, sheets, templates, java classes). This allows applications and plugins/components to include their own translation documents without requiring additional configuration, and without bloating ApplicationResources.properties.
- Powerful parametrized translations, as supported by the java MessageFormat class.
Usage
From velocity
The variable that gives access to the localization component is $l10n. A translation bundle is pulled by calling the function:$l10n.use(hint, bundleLocation)
$l10n.use("document", "The.Document")
$l10n.use("resource", "theBundle")
$l10n.get(key)
$l10n.get(key, parameters)
From Java
As with any other component, you can either declare a dependency on the localization tool in your components.xml file, and the component manager will inject a reference in your objects, or you can request the component from the component manager. The dependency should usually look like:<requirement> <role>org.xwiki.localization.LocalizationManager</role> </requirement>