mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Hardcoding correct module priorities in i18n.php
This commit is contained in:
parent
9e95ba0045
commit
3002598a5e
@ -1876,12 +1876,25 @@ class i18n extends Object implements TemplateGlobalProvider {
|
||||
// TODO Also include custom Zend_Translate routing languages
|
||||
$selectedLocales = array_unique(array($lang, $locale));
|
||||
|
||||
// Sort modules by inclusion priority, then alphabetically
|
||||
// TODO Should be handled by priority flags within modules
|
||||
$prios = array('sapphire' => 10, 'framework' => 10, 'admin' => 11, 'cms' => 12, 'mysite' => 90);
|
||||
$modules = SS_ClassLoader::instance()->getManifest()->getModules();
|
||||
ksort($modules);
|
||||
uksort(
|
||||
$modules,
|
||||
function($a, $b) use(&$prios) {
|
||||
$prioA = (isset($prios[$a])) ? $prios[$a] : 50;
|
||||
$prioB = (isset($prios[$b])) ? $prios[$b] : 50;
|
||||
return ($prioA > $prioB);
|
||||
}
|
||||
);
|
||||
|
||||
// Loop in reverse order, meaning the translator with the highest priority goes first
|
||||
$translators = array_reverse(self::get_translators(), true);
|
||||
foreach($translators as $priority => $translators) {
|
||||
foreach($translators as $name => $translator) {
|
||||
$adapter = $translator->getAdapter();
|
||||
$modules = SS_ClassLoader::instance()->getManifest()->getModules();
|
||||
|
||||
// Load translations from modules
|
||||
foreach($modules as $module) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user