This document sheds some light on how Confluence looks up a message text from one of the resource bundles.
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_<lang_country_variant>.properties
/com/atlassian/confluence/core/ConfluenceActionSupport_<lang_country>.properties
/com/atlassian/confluence/core/ConfluenceActionSupport_<lang>.properties
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>_<lang_country_variant>.properties
<resource location>_<lang_country>.properties
<resource location>_<lang>.properties
<resource location>.properties
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:
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:
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.
Given the following situation:
Lookups will always happen from top to bottom until a message for a given key is found.
Rate this page: