提交 7b94f422 编写于 作者: G gongfuxiang

新增西班牙语言

上级 d614f4bf
......@@ -285,7 +285,7 @@ return [
],
// 品牌分类
'brandcategory' => [
'brandcategory' => [
'base_nav_title' => 'BrandCategory',
],
......
此差异已折叠。
......@@ -285,7 +285,7 @@ return [
],
// 品牌分类
'brandcategory' => [
'brandcategory' => [
'base_nav_title' => '品牌分类',
],
......
......@@ -496,5 +496,132 @@ class Devtest extends Common
}
echo 'success:'.$success.', fail:'.$fail;
}
/**
* 语言翻译生成
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2023-03-24
* @desc description
*/
public function Fanyi()
{
if(input('pwd') != 'shopxo520')
{
die('非法访问');
}
// 待翻译的目录
$arr = [
APP_PATH.'lang'.DS,
APP_PATH.'admin'.DS.'lang'.DS,
APP_PATH.'index'.DS.'lang'.DS,
APP_PATH.'api'.DS.'lang'.DS,
];
// 需要翻译的语言、参考 config/lang.php文件
$to = 'spa';
$to_name = '西班牙语';
// 获取数据
$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);
$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[] = '公共语言包-中文';
$search[] = '模块语言包-中文';
$replace[] = '公共语言包-'.$to_name;
$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)
{
$result = [];
if(!empty($data) && is_array($data))
{
foreach($data as $v)
{
if(!empty($v))
{
if(is_array($v))
{
$result = array_merge($result, $this->FanyiData($v));
} else {
$result[md5($v)] = $v;
}
}
}
}
return $result;
}
}
?>
\ No newline at end of file
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://opensource.org/licenses/mit-license.php )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
/**
* 模块语言包-西班牙语
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
return [
// 基础公共
'token_error_tips' => 'Token ilegal',
// 文章
'article' => [
'article_no_data_tips' => 'El artículo no existe o ha sido eliminado',
'article_id_params_tips' => 'El ID del artículo es incorrecto',
],
// 订单管理
'order' => [
'form_you_have_commented_tips' => 'Ya has comentado',
],
];
?>
\ No newline at end of file
......@@ -423,7 +423,6 @@ return [
'goods' => 'Goods Info',
'goods_placeholder' => 'Please enter the goods name/brief description/SEO information',
'price' => 'Sales price (yuan)',
'original_price' => 'Original price (yuan)',
'add_time' => 'Creation time',
],
......@@ -437,7 +436,6 @@ return [
'goods' => 'Goods Info',
'goods_placeholder' => 'Please enter the goods name/brief description/SEO information',
'price' => 'Sales price (yuan)',
'original_price' => 'Original price (yuan)',
'add_time' => 'Creation time',
],
......@@ -457,7 +455,6 @@ return [
'type' => 'Operation Type',
'operation_integral' => 'Operation Integral',
'original_integral' => 'Original Integral',
'new_integral' => 'New Integral',
'msg' => 'Describe',
'add_time_time' => 'Time',
......
此差异已折叠。
......@@ -423,26 +423,24 @@ return [
'goods' => '商品信息',
'goods_placeholder' => '请输入商品名称/简述/SEO信息',
'price' => '销售价格(元)',
'original_price' => '原价(元)',
'add_time' => '创建时间',
],
],
// 用户商品收藏
'usergoodsfavor' => [
'browser_seo_title' => '商品收藏',
// 动态表格统计数据
'form_table' => [
'goods' => '商品信息',
'goods_placeholder' => '请输入商品名称/简述/SEO信息',
'price' => '销售价格(元)',
'original_price' => '原价(元)',
'add_time' => '创建时间',
],
],
// 用户商品收藏
'usergoodsfavor' => [
'browser_seo_title' => '商品收藏',
],
// 用户积分
'userintegral' => [
'browser_seo_title' => '我的积分',
......@@ -457,7 +455,6 @@ return [
'type' => '操作类型',
'operation_integral' => '操作积分',
'original_integral' => '原始积分',
'new_integral' => '最新积分',
'msg' => '描述',
'add_time_time' => '时间',
......@@ -470,7 +467,7 @@ return [
'edit_browser_seo_title' => '个人资料编辑',
'form_item_nickname' => '昵称',
'form_item_nickname_message' => '昵称2~16个字符之间',
'form_item_birthday' => '昵称',
'form_item_birthday' => '生日',
'form_item_birthday_message' => '生日格式有误',
'form_item_province' => '所在省',
'form_item_province_message' => '所在省最多30个字符',
......
......@@ -528,7 +528,7 @@ return [
'form_seo_title_tips' => 'Generally no more than 80 characters',
'form_seo_keywords_title' => 'SEO Keywords',
'form_seo_keywords_message' => 'SEO keyword format can be up to 130 characters',
'form_seo_keywords_tips' => 'Generally no more than 100 characters<br/>Multiple keywords are separated by semi-rounded commas [,]',
'form_seo_keywords_tips' => 'Generally no more than 100 characters Multiple keywords are separated by semi-rounded commas [,]',
'form_seo_desc_title' => 'SEO Description',
'form_seo_desc_message' => 'SEO description format can be up to 230 characters',
'form_seo_desc_tips' => 'Generally no more than 200 characters',
......
此差异已折叠。
......@@ -529,7 +529,7 @@ return [
'form_seo_title_tips' => '一般不超过80个字符',
'form_seo_keywords_title' => 'SEO关键字',
'form_seo_keywords_message' => 'SEO关键字格式最多130个字符',
'form_seo_keywords_tips' => '一般不超过100个字符<br />多个关键字以半圆角逗号 [ , ] 隔开',
'form_seo_keywords_tips' => '一般不超过100个字符多个关键字以半圆角逗号 [ , ] 隔开',
'form_seo_desc_title' => 'SEO描述',
'form_seo_desc_message' => 'SEO描述格式最多230个字符',
'form_seo_desc_tips' => '一般不超过200个字符',
......@@ -674,9 +674,9 @@ return [
// 搜索排序方式
'common_search_order_by_list' => [
['name' => '综合', 'type' => 'default', 'value' => 'desc'],
['name' => '销量', 'type' => 'sales', 'value' => 'desc'],
['name' => '热度', 'type' => 'access', 'value' => 'desc'],
['name' => '价格', 'type' => 'price', 'value' => 'desc'],
['name' => '销量', 'type' => 'sales', 'value' => 'desc'],
['name' => '热度', 'type' => 'access', 'value' => 'desc'],
['name' => '价格', 'type' => 'price', 'value' => 'desc'],
['name' => '最新', 'type' => 'new', 'value' => 'desc'],
],
// 用户注册类型列表
......@@ -1076,7 +1076,7 @@ return [
'save_email_already_exist_tips' => '电子邮箱已存在[{$var}]',
'save_admin_already_exist_tips' => '管理员已存在[{$var}]',
// 删除操作
'delete_super_admin_not_tips' => '超级管理员不可删除',
'delete_super_admin_not_tips' => '超级管理员不可删除',
// 登录
'login_verify_send_last_title' => ' - 管理员登录',
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册