| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | public function handle($request, Closure $next) |
||
| 43 | { |
||
| 44 | // 读取默认语言 |
||
| 45 | $this->lang->range($this->app->config->get('app.default_lang', 'zh-cn')); |
||
| 46 | |||
| 47 | if ($this->app->config->get('app.lang_switch_on', false)) { |
||
| 48 | // 开启多语言机制 检测当前语言 |
||
| 49 | $this->lang->detect(); |
||
| 50 | } |
||
| 51 | |||
| 52 | $request->setLangset($this->lang->range()); |
||
| 53 | |||
| 54 | // 加载系统语言包 |
||
| 55 | $this->lang->load([ |
||
| 56 | $this->app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $request->langset() . '.php', |
||
| 57 | $this->app->getAppPath() . 'lang' . DIRECTORY_SEPARATOR . $request->langset() . '.php', |
||
| 58 | ]); |
||
| 59 | |||
| 60 | return $next($request); |
||
| 61 | } |
||
| 63 |