diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-04-07 05:15:51 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-04-07 05:15:51 +0000 |
commit | 97c14a993ee998e8856d940c9f3fd35b520f4362 (patch) | |
tree | 237716784fc68a5cf6b50586b86254d50a32a589 /modules | |
parent | 8173fc1aa338a21bc2ea119fba37437cf3209a44 (diff) | |
download | brdo-97c14a993ee998e8856d940c9f3fd35b520f4362.tar.gz brdo-97c14a993ee998e8856d940c9f3fd35b520f4362.tar.bz2 |
- Patch #642782 by plach, Dave Reid, greggles, mfb: hook_language_init() is a bootstrap hook and needs bootstrap_invoke_all().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/locale/locale.api.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/locale/locale.api.php b/modules/locale/locale.api.php index 90f6132dd..488b2bbed 100644 --- a/modules/locale/locale.api.php +++ b/modules/locale/locale.api.php @@ -25,6 +25,33 @@ function hook_locale($op = 'groups') { } /** + * Allows modules to act after language initialization has been performed. + * + * This is primarily needed to provide translation for configuration variables + * in the proper bootstrap phase. Variables are user-defined strings and + * therefore should not be translated via t(), since the source string can + * change without notice and any previous translation would be lost. Moreover, + * since variables can be used in the bootstrap phase, we need a bootstrap hook + * to provide a translation early enough to avoid misalignments between code + * using the original values and code using the translated values. However + * modules implementing hook_boot() should be aware that language initialization + * did not happen yet and thus they cannot rely on translated variables. + */ +function hook_language_init() { + global $language, $conf; + + switch ($language->language) { + case 'it': + $conf['site_name'] = 'Il mio sito Drupal'; + break; + + case 'fr': + $conf['site_name'] = 'Mon site Drupal'; + break; + } +} + +/** * Perform alterations on language switcher links. * * A language switcher link may need to point to a different path or use a |