2. - Confluence Docs 3.0 : I18N Architecture This page last changed on Dec 05, 2008 by ckiehl. This document sheds some light on how Confluence looks up a message text from one of the resource bundles. ## Loading of Resources Currently the only implementation of the `I18NBean` interface is the `DefaultI18NBean`. When it is instantiated, it attempts to load resources from the following locations: Load `/com/atlassian/confluence/core/ConfluenceActionSupport.properties` and `/external-links.properties` and create a `CombinedResourceBundle` containing both of them. Load all language pack resources which match the current user's locale, which would be: `/com/atlassian/confluence/core/ConfluenceActionSupport_<country_lang_variant>.properties` `/com/atlassian/confluence/core/ConfluenceActionSupport_<country_lang>.properties` `/com/atlassian/confluence/core/ConfluenceActionSupport_<country>.properties`
     | Warning The files are only loaded if a language pack for the specific locale is installed.
Load all resources of type 'i18n' which match the current user's locale: `<resource location>_<country_lang_variant>.properties` `<resource location>_<country_lang>.properties` `<resource location>_<country>.properties` `<resource location>.properties` ## Resource Bundle Structure `DefaultI18NBean` internally creates a list of `CombinedResourceBundles` per locale, combining resource bundles from language packs and i18n resources of the same locale. When you call one of the `DefaultI18NBean.getText()` methods it will go through the bundles in the following order: country_lang_variant country_lang country default On a lookup of a combined resource bundle, the last occurrence of a given key takes precedence during the lookup, which results in the following lookup order: i18n resource language pack The order within i18n resources and language packs with the same locale is not defined, as they are loaded from the plugins which are loaded in an arbitrary order. This is not an issue in most cases, as you usually have no overlapping keys between your resources anyway. ## Example Given the following situation: The current user's locale is 'de_DE_foo' There are language packs installed for the locales 'de_DE_foo', 'de_DE' and 'de' There is one resource of type 'i18n' available from one of the plugins. The location for that resource is 'com.example.resources' The resource bundle structure would look like this: Lookups will always happen from top to bottom until a message for a given key is found. ##### RELATED TOPICS Confluence Internals Attachments: I18N Architecture (text/xml) I18N Architecture (text/xml) I18N Architecture (text/xml) I18N Architecture (text/xml) I18N Architecture (text/xml) I18N Architecture (text/xml) I18N Architecture (text/xml)

Document generated by Confluence on Nov 05, 2009 23:34