多语言支持
<h1>规则</h1>
<p><strong>语言代码标准:<a href="https://learn.microsoft.com/en-us/windows/win32/wmformat/language-strings" title="RFC 1766">RFC 1766</a> <font color=red>地区代码大写</font></strong>
<strong>优先顺序:$_GET[$name],$<em>SERVER["HTTP</em>{$name}"],$_COOKIE[$name],浏览器的设置语言,默认语言
$name 是配置文件中的 name 值</strong>
<strong>地区语言包不存在,则会查找国家代码的语言包:例如 en-US 不存在则会查找 en</strong></p>
<h1>入口文件中加载依赖: nec\z\lang</h1>
<pre><code><?php
define('APP_NAME', 'index'); /*定义应用目录名称*/
require '../core.php'; /*加载框架*/
AppRun(__DIR__, [
'nec\z\debug',
'nec\z\router',
'nec\z\lang', // 多语言支持
'nec\z\view',
]);</code></pre>
<h1>配置文件</h1>
<pre><code>'LANG'=>[
'name'=>'lang', // cookie 或 请求头的 识别名称
'default'=>'en-US', // 默认的语言包
],</code></pre>
<h1>语言包目录: /lang/语言代码/</h1>
<h1>语言包数据结构</h1>
<p><strong>使用 key => value 的数组结构
value 中可以使用 {$k1} {$k2} 形式的占位符,
调用时候 传入['k1'=>'value1', 'k2'=>'value2'] 来替换占位符</strong></p>
<pre><code><?php
declare(strict_types=1);
return [
'ERR_404'=>'Resource not found',
'ERR_500'=>'Server internal error',
'ERR_PARAMS'=>'Parameter error: {$0}, {$1}',
];</code></pre>
<h1>调用</h1>
<p><strong>参数1是语言包文件的键名,参数2是语言包文件名(不含.php后缀)</strong></p>
<pre><code>Lang('ERR_PARAMS', 'common', ['$a', '$b']); // 直接显示
$lang = GetLang('ERR_PARAMS', 'common', ['$a', '$b']); // 获取解析的值</code></pre>