fanyi
This commit is contained in:
@@ -27,6 +27,7 @@ class TranslationJob
|
||||
$sourceLang = $pt['sourceLang'];
|
||||
// $locale = $pt['locale'];
|
||||
$id = $pt['id'];
|
||||
$toLang = $pt['toLang'];
|
||||
|
||||
$translator = new TranslatorService();
|
||||
if($entityType == 'location'){
|
||||
@@ -47,14 +48,15 @@ class TranslationJob
|
||||
}
|
||||
|
||||
$languages = ['cn' => 'cn', 'en' => 'en', 'ru' => 'ru', 'ar' => 'ar'];
|
||||
$languages = array_merge(['to'=>$toLang],$languages);
|
||||
unset($languages[$sourceLang]);
|
||||
log::info('languages', [$languages]);
|
||||
foreach ($languages as $lang => $xflang) {
|
||||
|
||||
if($entityType =='location'){
|
||||
$fields = $translator->location($sourceFields,$lang,$sourceLang);
|
||||
$fields = $translator->location($sourceFields,$xflang,$sourceLang);
|
||||
}else{
|
||||
$fields = $translator->vehicle($sourceFields,$lang,$sourceLang);
|
||||
$fields = $translator->vehicle($sourceFields,$xflang,$sourceLang);
|
||||
}
|
||||
|
||||
$translationModel = $translationModels[$xflang];
|
||||
@@ -66,7 +68,7 @@ class TranslationJob
|
||||
}
|
||||
$translation->fill($fields);
|
||||
$res = $translation->save();
|
||||
log::info('$languages save '.$lang, [$res,$fields]);
|
||||
log::info('$languages save '.$xflang, [$res,$fields]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user