diff --git a/helpers/Data.php b/helpers/Data.php index 1d054f3..57cbf52 100644 --- a/helpers/Data.php +++ b/helpers/Data.php @@ -25,6 +25,8 @@ public static function cache($key, $duration, $callable) public static function getLocale() { - return strtolower(substr(Yii::$app->language, 0, 2)); + $muti_lan_array=['zh-cn','zh-tw']; + $language=strtolower(trim(Yii::$app->language)); + return in_array($language,$muti_lan_array,false)?$language:substr($language, 0, 2); } -} \ No newline at end of file +}