|
...
|
...
|
@@ -9,6 +9,7 @@ use App\Models\Product\Category; |
|
|
|
use App\Models\Product\Detail;
|
|
|
|
use App\Models\Product\Keyword;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\Template\BCustomTemplate;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
...
|
...
|
@@ -193,6 +194,30 @@ class SiteTranslate extends Command |
|
|
|
}
|
|
|
|
|
|
|
|
$this->output('项目ID : ' . $project_id . ' , 产品关键词翻译完成');
|
|
|
|
|
|
|
|
//翻译单页
|
|
|
|
$pages = BCustomTemplate::select(['id', 'name', 'title', 'keywords', 'description'])->get();
|
|
|
|
foreach ($pages as $v_page) {
|
|
|
|
$need_trans_page = [
|
|
|
|
$v_page->name,
|
|
|
|
$v_page->title,
|
|
|
|
$v_page->keywords,
|
|
|
|
$v_page->description,
|
|
|
|
];
|
|
|
|
$re_trans_page = Translate::translate($need_trans_page, $tls);
|
|
|
|
if (isset($re_trans_page[0]['code']) && $re_trans_page[0]['code'] == 200) {
|
|
|
|
$page_trans_texts = $re_trans_page[0]['texts'];
|
|
|
|
$v_page->name = $page_trans_texts[0] != $replace ? $page_trans_texts[0] : '';
|
|
|
|
$v_page->title = $page_trans_texts[1] != $replace ? $page_trans_texts[1] : '';
|
|
|
|
$v_page->keywords = $page_trans_texts[2] != $replace ? $page_trans_texts[2] : '';
|
|
|
|
$v_page->description = $page_trans_texts[3] != $replace ? $page_trans_texts[3] : '';
|
|
|
|
$v_page->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->output('项目ID : ' . $project_id . ' , 单页翻译完成');
|
|
|
|
|
|
|
|
$this->output('项目ID : ' . $project_id . ' , 整站内容翻译结束');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
...
|
...
|
|