From 5236e09026e72bb361d92b28b2dec7c87d5600e0 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 26 Nov 2010 01:52:44 +0000 Subject: [PATCH] BUGFIX Including template /lang folders in i18n::include_by_locale() (implementation started in r113919) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@114208 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/i18n.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/core/i18n.php b/core/i18n.php index 9cf664f39..a2f9c52d1 100755 --- a/core/i18n.php +++ b/core/i18n.php @@ -1467,7 +1467,7 @@ class i18n extends Object { // fallback to the passed $string if no translation is present $transEntity = isset($lang[$locale][$class][$realEntity]) ? $lang[$locale][$class][$realEntity] : $string; - + // entities can be stored in both array and literal values in the language tables return (is_array($transEntity) ? $transEntity[0] : $transEntity); } @@ -1841,6 +1841,18 @@ class i18n extends Object { else include_once($file); } } + + // Load translations from themes + $themesBase = $base . '/themes'; + foreach(scandir($themesBase) as $theme) { + if( + strpos($theme, SSViewer::current_theme()) === 0 + && file_exists($file = "$themesBase/$theme/lang/$locale.php") + ) { + if ($force_load) include($file); + else include_once($file); + } + } // Finally, load any translations from registered plugins if ($load_plugins) self::plugins_load($locale);