Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MINOR Hardcoding correct module priorities in i18n.php

  • Loading branch information...
commit 3002598a5e47284d3e077bac4a8a7b04cf77185f 1 parent 9e95ba0
@chillu chillu authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 i18n/i18n.php
View
15 i18n/i18n.php
@@ -1876,12 +1876,25 @@ static function include_by_locale($locale) {
// 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) {
Please sign in to comment.
Something went wrong with that request. Please try again.