diff --git a/docs/en/topics/i18n.md b/docs/en/topics/i18n.md index a497272bf..027aaa023 100644 --- a/docs/en/topics/i18n.md +++ b/docs/en/topics/i18n.md @@ -223,6 +223,40 @@ If you want to run the text collector for just one module you can use the 'modul You'll need to install PHPUnit to run the text collector (see [testing-guide](/topics/testing)). +## Module Priority + +The order in which i18n strings are loaded from modules can be quite important, as it is pretty common for a site +developer to want to override the default i18n strings from time to time. Because of this, you will sometimes need to specify the loading priority of i18n modules. + +By default, the language files are loaded from modules in this order: + + * Your project (as defined in the `$project` global) + * admin + * framework + * All other modules + +This default order is configured in `framework/_config/i18n.yml`. This file specifies two blocks of module ordering: `basei18n`, listing admin, and framework, and `defaulti18n` listing all other modules. + +To create a custom module order, you need to specify a config fragment that inserts itself either after or before those items. For example, you may have a number of modules that have to come after the framework/admin, but before anyhting else. To do that, you would use this + + --- + Name: customi18n + Before: 'defaulti18n' + --- + i18n: + module_priority: + - module1 + - module2 + - module3 + +The config option being set is `i18n.module_priority`, and it is a list of module names. + +There are a few special cases: + + * If not explicitly mentioned, your project is put as the first module. + * The module name `other_modules` can be used as a placeholder for all modules that aren't + specifically mentioned. + ## Language definitions Each module can have one language table per locale, stored by convention in the `lang/` subfolder.