mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
#2069 Locale file /lang/en_US.php should exist (Windows)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@47580 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
c1e0533efc
commit
817f7604c6
@ -926,14 +926,14 @@ class i18n extends Controller {
|
||||
protected static function get_owner_module($name) {
|
||||
if (substr($name,-3) == '.ss') {
|
||||
global $_TEMPLATE_MANIFEST;
|
||||
$path = current($_TEMPLATE_MANIFEST[substr($name,0,-3)]);
|
||||
ereg(Director::baseFolder() . '/([^/]+)/',$path,$module);
|
||||
$path = str_replace('\\','/',Director::makeRelative(current($_TEMPLATE_MANIFEST[substr($name,0,-3)])));
|
||||
ereg('/([^/]+)/',$path,$module);
|
||||
} else {
|
||||
global $_CLASS_MANIFEST;
|
||||
$path = $_CLASS_MANIFEST[$name];
|
||||
ereg(Director::baseFolder() . '/([^/]+)/',$path,$module);
|
||||
$path = str_replace('\\','/',Director::makeRelative($_CLASS_MANIFEST[$name]));
|
||||
ereg('/([^/]+)/', $path, $module);
|
||||
}
|
||||
return $module[1];
|
||||
return ($module) ? $module[1] : false;
|
||||
|
||||
}
|
||||
|
||||
@ -1245,13 +1245,15 @@ class i18n extends Controller {
|
||||
*/
|
||||
static function include_by_class($class) {
|
||||
$module = self::get_owner_module($class);
|
||||
if(!$module) user_error("i18n::include_by_class: Class {$class} not found", E_USER_WARNING);
|
||||
|
||||
if (file_exists($file = Director::getAbsFile("$module/lang/". self::get_locale() . '.php'))) {
|
||||
include_once($file);
|
||||
} else if (self::get_locale() != 'en_US') {
|
||||
self::set_locale('en_US');
|
||||
self::include_by_class($class);
|
||||
} else {
|
||||
user_error("Locale file $file should exist", E_USER_WARNING);
|
||||
user_error("i18n::include_by_class: Locale file $file should exist", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1316,4 +1318,4 @@ class i18n extends Controller {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user