细节优化
parent
736dc6b706
commit
2e0ee6811c
|
|
@ -125,7 +125,7 @@
|
|||
{{else /}}
|
||||
<div class="am-text-center am-padding-vertical-lg register-close">
|
||||
<i class="am-icon-warning"></i>
|
||||
<span>{{:MyLang('user.login_close_tips')}}</span>
|
||||
<span>{{:MyLang('admin.login_close_tips')}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -615,6 +615,115 @@ class Devtest extends Common
|
|||
}
|
||||
die('success:'.$success.', fail:'.$fail);
|
||||
}
|
||||
/**
|
||||
* 插件语言翻译生成
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2023-03-24
|
||||
* @desc description
|
||||
*/
|
||||
public function PluginsFanyi()
|
||||
{
|
||||
// if(input('pwd') != 'shopxo520')
|
||||
// {
|
||||
// die('非法访问');
|
||||
// }
|
||||
// die('禁止访问');
|
||||
|
||||
// 需要翻译的语言、参考 config/lang.php文件
|
||||
$to = 'en';
|
||||
$to_name = '英文';
|
||||
$plugins = 'erp';
|
||||
|
||||
// 待翻译的目录
|
||||
$arr = [
|
||||
APP_PATH.'plugins'.DS.$plugins.DS.'lang'.DS,
|
||||
APP_PATH.'plugins'.DS.$plugins.DS.'lang'.DS.'admin'.DS,
|
||||
APP_PATH.'plugins'.DS.$plugins.DS.'lang'.DS.'index'.DS,
|
||||
];
|
||||
|
||||
// 获取数据
|
||||
$zh_data = [];
|
||||
foreach($arr as $dir)
|
||||
{
|
||||
if(!is_dir($dir))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$zh_file = $dir.'zh.php';
|
||||
if(!file_exists($zh_file))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$temp = require $zh_file;
|
||||
$zh_data = array_merge($zh_data, $this->FanyiData($temp));
|
||||
}
|
||||
|
||||
// 翻译数据 并 生成数据
|
||||
$params = [];
|
||||
$vers = get_class_vars(get_class());
|
||||
foreach($vers as $k=>$v)
|
||||
{
|
||||
if(property_exists($this, $k))
|
||||
{
|
||||
$params[$k] = $this->$k;
|
||||
}
|
||||
}
|
||||
$params['data_request']['to'] = $to;
|
||||
$params['data_request']['q'] = implode("\n", $zh_data);
|
||||
//$params['data_request']['q'] = "你好\n我是龚";
|
||||
$fanyi = PluginsControlCall('multilingual', 'index', 'fanyi', 'index', $params, 1);
|
||||
if(isset($fanyi['code']) && $fanyi['code'] != 0)
|
||||
{
|
||||
die($fanyi['msg']);
|
||||
}
|
||||
$fanyi_data = (!empty($fanyi['data']) && !empty($fanyi['data']['trans_result'])) ? $fanyi['data']['trans_result'] : [];
|
||||
if(empty($fanyi_data))
|
||||
{
|
||||
die('没有翻译数据');
|
||||
}
|
||||
|
||||
// 替换数据
|
||||
$search = array_map(function($item)
|
||||
{
|
||||
return "'".$item."'";
|
||||
}, array_column($fanyi_data, 'src'));
|
||||
$replace = array_map(function($item)
|
||||
{
|
||||
return "'".str_replace("'", '', $item)."'";
|
||||
}, array_column($fanyi_data, 'dst'));
|
||||
// 加入标题名称
|
||||
$search[] = '语言包-中文';
|
||||
$replace[] = '语言包-'.$to_name;
|
||||
|
||||
// 开始生成文件并替换数据
|
||||
$success = 0;
|
||||
$fail = 0;
|
||||
foreach($arr as $dir)
|
||||
{
|
||||
// 复制文件
|
||||
$zh_file = $dir.'zh.php';
|
||||
if(!file_exists($zh_file))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$to_file = $dir.$to.'.php';
|
||||
if(!\base\FileUtil::CopyFile($zh_file, $to_file, true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// 生成文件并替换
|
||||
$content = file_get_contents($to_file);
|
||||
if(file_put_contents($to_file, str_replace($search, $replace, $content)) !== false)
|
||||
{
|
||||
$success++;
|
||||
} else {
|
||||
$fail++;
|
||||
}
|
||||
}
|
||||
die('success:'.$success.', fail:'.$fail);
|
||||
}
|
||||
// 翻译数据递归获取
|
||||
public function FanyiData($data)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ function GetUrlHost($url)
|
|||
}
|
||||
|
||||
// 判断是否是双后缀
|
||||
$preg = '/[\w].+\.(com|net|org|gov|ac|bj|sh|tj|cq|he|sn|sx|nm|ln|jl|hl|js|zj|ah|fj|jx|sd|ha|hb|hn|gd|gx|hi|sc|gz|yn|gs|qh|nx|xj|tw|hk|mo|xz|edu|ge|dev|co)\.(cn|nz|mm)$/';
|
||||
$preg = '/[\w].+\.(com|net|org|gov|ac|bj|sh|tj|cq|he|sn|sx|nm|ln|jl|hl|js|zj|ah|fj|jx|sd|ha|hb|hn|gd|gx|hi|sc|gz|yn|gs|qh|nx|xj|tw|hk|mo|xz|edu|ge|dev|co)\.(cn|nz|mm|ec)$/';
|
||||
if(($n > 2) && preg_match($preg, $host))
|
||||
{
|
||||
// 双后缀取后3位
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => '暫時關閉用戶註冊',
|
||||
'close_user_login_tips' => '暫時關閉用戶登錄',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP備案',
|
||||
'footer_public_security_filing_text' => '警察備案',
|
||||
'footer_business_license_text' => '電子營業執照亮照',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Benutzerregistrierung vorübergehend schließen',
|
||||
'close_user_login_tips' => 'Benutzeranmeldung vorübergehend deaktivieren',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP-Einreichung',
|
||||
'footer_public_security_filing_text' => 'Einreichung der öffentlichen Sicherheit',
|
||||
'footer_business_license_text' => 'Elektronische Gewerbelizenzbeleuchtung',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Temporarily close user registration',
|
||||
'close_user_login_tips' => 'Temporarily close user login',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP Filing',
|
||||
'footer_public_security_filing_text' => 'Public Security Filing',
|
||||
'footer_business_license_text' => 'Electronic Business License Illumination',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Fermer temporairement linscription des utilisateurs',
|
||||
'close_user_login_tips' => 'Fermer temporairement le login de lutilisateur',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'Dépôt ICP',
|
||||
'footer_public_security_filing_text' => 'Dépôt de la sécurité publique',
|
||||
'footer_business_license_text' => 'Licence dentreprise électronique illuminée',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Registrazione temporanea dellutente',
|
||||
'close_user_login_tips' => 'Disattivare temporaneamente laccesso utente',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'Deposito ICP',
|
||||
'footer_public_security_filing_text' => 'Archiviazione di pubblica sicurezza',
|
||||
'footer_business_license_text' => 'Illuminazione elettronica delle licenze commerciali',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'ユーザー登録の一時停止',
|
||||
'close_user_login_tips' => 'ユーザーログインの一時停止',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP届出',
|
||||
'footer_public_security_filing_text' => '警察の届出',
|
||||
'footer_business_license_text' => '電子営業許可証点灯',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => '사용자 등록 일시 해제',
|
||||
'close_user_login_tips' => '사용자 로그인 일시 닫기',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP 등록',
|
||||
'footer_public_security_filing_text' => '공안 등록',
|
||||
'footer_business_license_text' => '전자 영업 허가증',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Gebruikersregistratie tijdelijk afsluiten',
|
||||
'close_user_login_tips' => 'Gebruikersaanmelding tijdelijk uitschakelen',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP-indiening',
|
||||
'footer_public_security_filing_text' => 'Openbare veiligheid',
|
||||
'footer_business_license_text' => 'Verlichting van elektronische bedrijfsvergunning',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Временное закрытие регистрации пользователей',
|
||||
'close_user_login_tips' => 'Временно отключить вход пользователя',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'Регистрация ICP',
|
||||
'footer_public_security_filing_text' => 'Регистрация общественной безопасности',
|
||||
'footer_business_license_text' => 'Электронная лицензия.',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Cierre temporal del registro de usuarios',
|
||||
'close_user_login_tips' => 'Cierre temporalmente el inicio de sesión del usuario',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'Registro ICP',
|
||||
'footer_public_security_filing_text' => 'Registro de seguridad pública',
|
||||
'footer_business_license_text' => 'Licencia comercial electrónica iluminada',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Tillfälligt stängd användarregistrering',
|
||||
'close_user_login_tips' => 'Stäng tillfälligt av användarinloggning',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP-arkivering',
|
||||
'footer_public_security_filing_text' => 'Registrering av allmän säkerhet',
|
||||
'footer_business_license_text' => 'Elektronisk affärslicensbelysning',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'ปิดการลงทะเบียนผู้ใช้ชั่วคราว',
|
||||
'close_user_login_tips' => 'ปิดการเข้าสู่ระบบผู้ใช้ชั่วคราว',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'การยื่น ICP',
|
||||
'footer_public_security_filing_text' => 'บันทึกความปลอดภัยสาธารณะ',
|
||||
'footer_business_license_text' => 'ใบอนุญาตประกอบธุรกิจอิเล็กทรอนิกส์',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => 'Tạm thời đóng đăng ký người dùng',
|
||||
'close_user_login_tips' => 'Tạm thời tắt đăng nhập người dùng',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'Hồ sơ ICP',
|
||||
'footer_public_security_filing_text' => 'Công an lập hồ sơ',
|
||||
'footer_business_license_text' => 'Giấy phép kinh doanh điện tử',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ return [
|
|||
],
|
||||
'close_user_register_tips' => '暂时关闭用户注册',
|
||||
'close_user_login_tips' => '暂时关闭用户登录',
|
||||
// 底部
|
||||
'footer_icp_filing_text' => 'ICP备案',
|
||||
'footer_public_security_filing_text' => '公安备案',
|
||||
'footer_business_license_text' => '电子营业执照亮照',
|
||||
],
|
||||
|
||||
// 首页
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<b>|</b>
|
||||
<p class="footer-icp">
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank">
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-icp-icon.png" alt="ICP备案" />
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-icp-icon.png" alt="{{:MyLang('common.footer_icp_filing_text')}}" />
|
||||
{{$home_site_icp}}
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
<b>|</b>
|
||||
<p class="footer-icp">
|
||||
<a {{if empty($home_site_security_record_url)}}href="javascript:;"{{else /}}href="{{$home_site_security_record_url}}" target="_blank"{{/if}}>
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-gongan-icon.png" alt="公安备案" />
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-gongan-icon.png" alt="{{:MyLang('common.footer_public_security_filing_text')}}" />
|
||||
{{$home_site_security_record_name}}
|
||||
</a>
|
||||
</p>
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
<b>|</b>
|
||||
<p class="footer-icp">
|
||||
<a href="{{$home_site_company_license}}" target="_blank">
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-company-license-icon.png" alt="电子营业执照亮照" />
|
||||
电子营业执照亮照
|
||||
<img src="{{$attachment_host}}/static/common/images/beian-company-license-icon.png" alt="{{:MyLang('common.footer_business_license_text')}}" />
|
||||
{{:MyLang('common.footer_business_license_text')}}
|
||||
</a>
|
||||
</p>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ if(empty($_SERVER['HTTP_HOST']))
|
|||
$main_domain = '';
|
||||
} else {
|
||||
// 判断是否是双后缀
|
||||
$preg = '/[\w].+\.(com|net|org|gov|ac|bj|sh|tj|cq|he|sn|sx|nm|ln|jl|hl|js|zj|ah|fj|jx|sd|ha|hb|hn|gd|gx|hi|sc|gz|yn|gs|qh|nx|xj|tw|hk|mo|xz|edu|ge|dev|co)\.(cn|nz|mm)$/';
|
||||
$preg = '/[\w].+\.(com|net|org|gov|ac|bj|sh|tj|cq|he|sn|sx|nm|ln|jl|hl|js|zj|ah|fj|jx|sd|ha|hb|hn|gd|gx|hi|sc|gz|yn|gs|qh|nx|xj|tw|hk|mo|xz|edu|ge|dev|co)\.(cn|nz|mm|ec)$/';
|
||||
if($len > 2 && preg_match($preg, $main_domain))
|
||||
{
|
||||
// 双后缀取后3位
|
||||
|
|
|
|||
Loading…
Reference in New Issue