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) {
|
protected static function get_owner_module($name) {
|
||||||
if (substr($name,-3) == '.ss') {
|
if (substr($name,-3) == '.ss') {
|
||||||
global $_TEMPLATE_MANIFEST;
|
global $_TEMPLATE_MANIFEST;
|
||||||
$path = current($_TEMPLATE_MANIFEST[substr($name,0,-3)]);
|
$path = str_replace('\\','/',Director::makeRelative(current($_TEMPLATE_MANIFEST[substr($name,0,-3)])));
|
||||||
ereg(Director::baseFolder() . '/([^/]+)/',$path,$module);
|
ereg('/([^/]+)/',$path,$module);
|
||||||
} else {
|
} else {
|
||||||
global $_CLASS_MANIFEST;
|
global $_CLASS_MANIFEST;
|
||||||
$path = $_CLASS_MANIFEST[$name];
|
$path = str_replace('\\','/',Director::makeRelative($_CLASS_MANIFEST[$name]));
|
||||||
ereg(Director::baseFolder() . '/([^/]+)/',$path,$module);
|
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) {
|
static function include_by_class($class) {
|
||||||
$module = self::get_owner_module($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'))) {
|
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') {
|
||||||
self::set_locale('en_US');
|
self::set_locale('en_US');
|
||||||
self::include_by_class($class);
|
self::include_by_class($class);
|
||||||
} else {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user