1.新增马来语ms,修改有商品管理和所有接口返回

This commit is contained in:
2026-04-21 14:30:15 +08:00
parent 3ac825f15d
commit 7b9187fb62
11 changed files with 501 additions and 59 deletions

View File

@@ -12,7 +12,7 @@ use Webman\Http\Response;
* 加载控制器语言包中间件Webman 迁移版,等价 ThinkPHP LoadLangPack
* 根据当前路由加载对应控制器的语言包到 Translator
*
* 对外 api/:优先请求头 langzh / zh-cn → 中文包 zh-cnen → 英文包),未传则 think-lang再默认 zh-cn不根据浏览器 Accept-Language
* 对外 api/:优先请求头 langzh / zh-cn → zh-cnen → enms → 马来语包),未传则 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;
}