mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX #4038 If attempting to set a default locale that doesn't exist, throw a warning in Translatable::set_default_locale()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@76949 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
60623a42c3
commit
ad7d3a5b9d
@ -253,7 +253,12 @@ class Translatable extends DataObjectDecorator {
|
||||
* @param $locale String
|
||||
*/
|
||||
static function set_default_locale($locale) {
|
||||
self::$default_locale = $locale;
|
||||
$localeList = i18n::get_locale_list();
|
||||
if(isset($localeList[$locale])) {
|
||||
self::$default_locale = $locale;
|
||||
} else {
|
||||
user_error("Translatable::set_default_locale(): '$locale' is not a valid locale.", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user