This document sheds some light on how Confluence looks up a message text from one of the resource bundles.
Loading of Resources
/external-links.propertiesand create a
CombinedResourceBundlecontaining both of them.
- Load all language pack resources which match the current user's locale, which would be:
- Load all resources of type 'i18n' which match the current user's locale:
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:
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.
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'
Lookups will always happen from top to bottom until a message for a given key is found.