Merge branch 'feature/stock_next_fanyi' into develop
This commit is contained in:
@@ -5,6 +5,8 @@ namespace app\admin\service;
|
|||||||
use app\admin\validate\SysCurrencyValidate;
|
use app\admin\validate\SysCurrencyValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\SysCurrency;
|
use app\common\model\SysCurrency;
|
||||||
|
use app\common\utils\translation\service\TranslationService;
|
||||||
|
use app\queue\utils\Translat;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
class SysCurrencyService
|
class SysCurrencyService
|
||||||
@@ -58,4 +60,20 @@ class SysCurrencyService
|
|||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $translatFields = ['currency_name'];
|
||||||
|
|
||||||
|
public function afterServiceStore($res)
|
||||||
|
{
|
||||||
|
$sourceLocale = locale();
|
||||||
|
$data = $res->toArray();
|
||||||
|
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||||
|
|
||||||
|
(new TranslationService())->queueTranslations(
|
||||||
|
'sys_currency',
|
||||||
|
$res['id'],
|
||||||
|
$sourceLocale,
|
||||||
|
$traitsourceFields
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@ namespace app\admin\service;
|
|||||||
use app\admin\validate\SysDictItemValidate;
|
use app\admin\validate\SysDictItemValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\SysDictItem;
|
use app\common\model\SysDictItem;
|
||||||
|
use app\common\utils\translation\service\TranslationService;
|
||||||
|
use app\queue\utils\Translat;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
class SysDictItemService
|
class SysDictItemService
|
||||||
@@ -72,4 +74,20 @@ class SysDictItemService
|
|||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $translatFields = ['item_label','remark'];
|
||||||
|
|
||||||
|
public function afterServiceStore($res)
|
||||||
|
{
|
||||||
|
$sourceLocale = locale();
|
||||||
|
$data = $res->toArray();
|
||||||
|
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||||
|
|
||||||
|
(new TranslationService())->queueTranslations(
|
||||||
|
'sys_dict_item',
|
||||||
|
$res['id'],
|
||||||
|
$sourceLocale,
|
||||||
|
$traitsourceFields
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@ namespace app\admin\service;
|
|||||||
use app\admin\validate\SysDictValidate;
|
use app\admin\validate\SysDictValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\SysDict;
|
use app\common\model\SysDict;
|
||||||
|
use app\common\utils\translation\service\TranslationService;
|
||||||
|
use app\queue\utils\Translat;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
class SysDictService
|
class SysDictService
|
||||||
@@ -133,4 +135,20 @@ class SysDictService
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public $translatFields = ['dict_name', 'description'];
|
||||||
|
|
||||||
|
public function afterServiceStore($res)
|
||||||
|
{
|
||||||
|
$sourceLocale = locale();
|
||||||
|
$data = $res->toArray();
|
||||||
|
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||||
|
|
||||||
|
(new TranslationService())->queueTranslations(
|
||||||
|
'sys_dict',
|
||||||
|
$res['id'],
|
||||||
|
$sourceLocale,
|
||||||
|
$traitsourceFields
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,8 @@ namespace app\admin\service;
|
|||||||
use app\admin\validate\SysPortValidate;
|
use app\admin\validate\SysPortValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\SysPort;
|
use app\common\model\SysPort;
|
||||||
|
use app\common\utils\translation\service\TranslationService;
|
||||||
|
use app\queue\utils\Translat;
|
||||||
use support\Request;
|
use support\Request;
|
||||||
|
|
||||||
class SysPortService
|
class SysPortService
|
||||||
@@ -22,6 +24,8 @@ class SysPortService
|
|||||||
*/
|
*/
|
||||||
protected $validator = SysPortValidate::class;
|
protected $validator = SysPortValidate::class;
|
||||||
|
|
||||||
|
public $translatFields = ['port_name','description'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证器
|
* 获取验证器
|
||||||
*/
|
*/
|
||||||
@@ -97,6 +101,20 @@ class SysPortService
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function afterServiceStore($res)
|
||||||
|
{
|
||||||
|
$sourceLocale = locale();
|
||||||
|
$data = $res->toArray();
|
||||||
|
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||||
|
|
||||||
|
(new TranslationService())->queueTranslations(
|
||||||
|
'sys_port_translation',
|
||||||
|
$res['id'],
|
||||||
|
$sourceLocale,
|
||||||
|
$traitsourceFields
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加前置处理
|
* 添加前置处理
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ namespace app\admin\service;
|
|||||||
use app\admin\validate\VehColorValidate;
|
use app\admin\validate\VehColorValidate;
|
||||||
use app\common\traits\crud\CrudServiceTrait;
|
use app\common\traits\crud\CrudServiceTrait;
|
||||||
use app\common\model\VehColor;
|
use app\common\model\VehColor;
|
||||||
|
use app\common\utils\translation\service\TranslationService;
|
||||||
|
use app\queue\utils\Translat;
|
||||||
|
|
||||||
class VehColorService
|
class VehColorService
|
||||||
{
|
{
|
||||||
@@ -21,6 +23,8 @@ class VehColorService
|
|||||||
*/
|
*/
|
||||||
protected $validator = VehColorValidate::class;
|
protected $validator = VehColorValidate::class;
|
||||||
|
|
||||||
|
public $translatFields = ['color_text'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证器
|
* 获取验证器
|
||||||
*/
|
*/
|
||||||
@@ -28,4 +32,18 @@ class VehColorService
|
|||||||
{
|
{
|
||||||
return new $this->validator;
|
return new $this->validator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function afterServiceStore($res)
|
||||||
|
{
|
||||||
|
$sourceLocale = locale();
|
||||||
|
$data = $res->toArray();
|
||||||
|
$traitsourceFields = Translat::extractSourceFields($data, $this->translatFields);
|
||||||
|
|
||||||
|
(new TranslationService())->queueTranslations(
|
||||||
|
'veh_color_translation',
|
||||||
|
$res['id'],
|
||||||
|
$sourceLocale,
|
||||||
|
$traitsourceFields
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class SysCurrencyTranslation extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'sys_currency_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'currency_id', 'locale', 'currency_name', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class SysDictItemTranslation extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'sys_dict_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'dict_id', 'remark', 'locale', 'dict_name', 'description', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class SysDictTranslation extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'sys_dict_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'dict_id', 'locale', 'dict_name', 'description', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class SysPortTranslation extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'sys_port_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'port_id', 'locale', 'port_name', 'description', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
class VehColorTranslation extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The connection name for the model.
|
||||||
|
*
|
||||||
|
* @var string|null
|
||||||
|
*/
|
||||||
|
protected $connection = 'mysql';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'veh_color_translation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true;
|
||||||
|
|
||||||
|
|
||||||
|
protected $dateFormat = 'U';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $fillable = ['id', 'color_id', 'locale', 'color_text', 'created_at', 'updated_at'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不允许自动填充模型字段
|
||||||
|
*/
|
||||||
|
protected $guarded = [];
|
||||||
|
}
|
||||||
@@ -7,6 +7,26 @@ return [
|
|||||||
'translation_model' => \app\ticket\model\CategorieTranslation::class,
|
'translation_model' => \app\ticket\model\CategorieTranslation::class,
|
||||||
'foreign_key' => 'categorie_id',
|
'foreign_key' => 'categorie_id',
|
||||||
],
|
],
|
||||||
|
'sys_currency' => [
|
||||||
|
'translation_model' => app\common\model\SysCurrencyTranslation::class,
|
||||||
|
'foreign_key' => 'currency_id',
|
||||||
|
],
|
||||||
|
'sys_dict' => [
|
||||||
|
'translation_model' => app\common\model\SysDictTranslation::class,
|
||||||
|
'foreign_key' => 'dict_id',
|
||||||
|
],
|
||||||
|
'sys_dict_item' => [
|
||||||
|
'translation_model' => app\common\model\SysDictItemTranslation::class,
|
||||||
|
'foreign_key' => 'dict_item_id',
|
||||||
|
],
|
||||||
|
'sys_port_translation' => [
|
||||||
|
'translation_model' => app\common\model\SysPortTranslation::class,
|
||||||
|
'foreign_key' => 'port_id',
|
||||||
|
],
|
||||||
|
'veh_color_translation' => [
|
||||||
|
'translation_model' => app\common\model\VehColorTranslation::class,
|
||||||
|
'foreign_key' => 'color_id',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
// 默认支持的目标语种列表
|
// 默认支持的目标语种列表
|
||||||
|
|||||||
Reference in New Issue
Block a user