1.新增马来语ms,修改有商品管理和所有接口返回
This commit is contained in:
@@ -12,7 +12,7 @@ use Webman\Http\Response;
|
||||
* 加载控制器语言包中间件(Webman 迁移版,等价 ThinkPHP LoadLangPack)
|
||||
* 根据当前路由加载对应控制器的语言包到 Translator
|
||||
*
|
||||
* 对外 api/:优先请求头 lang(zh / zh-cn → 中文包 zh-cn,en → 英文包),未传则 think-lang,再默认 zh-cn(不根据浏览器 Accept-Language)
|
||||
* 对外 api/:优先请求头 lang(zh / zh-cn → zh-cn,en → en,ms → 马来语包),未传则 think-lang,再默认 zh-cn(不根据浏览器 Accept-Language)
|
||||
* admin/:think-lang → Accept-Language → 配置默认
|
||||
*/
|
||||
class LoadLangPack implements MiddlewareInterface
|
||||
@@ -138,6 +138,12 @@ class LoadLangPack implements MiddlewareInterface
|
||||
if (str_starts_with($s, 'en')) {
|
||||
return in_array('en', $allowLangList, true) ? 'en' : null;
|
||||
}
|
||||
if ($s === 'ms' || str_starts_with($s, 'ms-')) {
|
||||
return in_array('ms', $allowLangList, true) ? 'ms' : null;
|
||||
}
|
||||
if ($s === 'may') {
|
||||
return in_array('ms', $allowLangList, true) ? 'ms' : null;
|
||||
}
|
||||
if ($s === 'zh' || str_starts_with($s, 'zh-')) {
|
||||
return in_array('zh-cn', $allowLangList, true) ? 'zh-cn' : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user