Added docs for i81n.moduole_priority.

This commit is contained in:
Sam Minnee 2013-04-09 12:39:45 +12:00
parent efea4dbe94
commit b5a83878dd

View File

@ -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)).
</div>
## 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.