rbarreiros: 019 - Lost Locale when translatable string not found

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47850 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-01-10 22:33:18 +00:00
parent bdfb482046
commit ebc50a85c7

View File

@ -1257,15 +1257,15 @@ class i18n extends Controller {
if (file_exists($file = Director::getAbsFile("$module/lang/". self::get_locale() . '.php'))) { if (file_exists($file = Director::getAbsFile("$module/lang/". self::get_locale() . '.php'))) {
include_once($file); include_once($file);
} else if (self::get_locale() != 'en_US') { } else if (self::get_locale() != 'en_US') {
$old = self::get_locale();
self::set_locale('en_US'); self::set_locale('en_US');
self::include_by_class($class); self::include_by_class($class);
self::set_locale($old);
} else if(file_exists(Director::getAbsFile("$module/lang"))) { } else if(file_exists(Director::getAbsFile("$module/lang"))) {
// Throw an error if the given module doesn't have translations
if($module != project()) {
user_error("i18n::include_by_class: Locale file $file should exist", E_USER_WARNING); user_error("i18n::include_by_class: Locale file $file should exist", E_USER_WARNING);
} }
} }
}
//-----------------------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------------------//