【发布时间】:2018-08-23 00:15:04
【问题描述】:
Drupal 7 到 Drupal 8 的迁移。我已迁移源语言中的术语,但无法迁移术语的翻译 (i18n) - 名称和描述。
我创建了一个自定义源插件,我在其中创建了带有分类名称和描述翻译的新字段。
那么如何迁移术语翻译? D6 示例不起作用。
谢谢。
【问题讨论】:
标签: drupal drupal-8 drupal-taxonomy
Drupal 7 到 Drupal 8 的迁移。我已迁移源语言中的术语,但无法迁移术语的翻译 (i18n) - 名称和描述。
我创建了一个自定义源插件,我在其中创建了带有分类名称和描述翻译的新字段。
那么如何迁移术语翻译? D6 示例不起作用。
谢谢。
【问题讨论】:
标签: drupal drupal-8 drupal-taxonomy
您可以使用FEEDS MODULE 导入分类、节点、用户、产品、自定义块、段落、自定义菜单链接。
为了导入字段的多个值,您还需要调用模块 FEEDS TAMPER.
【讨论】:
您可以在完全迁移您的分类后执行这些步骤(无需翻译):
drush mim module_name
我的 yuml sn-p of process term without trans:
# to_db_value : from_db_value.
# d8_db_value : d7_db_value
tid: tid
vid:
plugin: migration_lookup
migration: your_vocabulary_migration
source: vid
langcode:
plugin: default_value
default_value: en // your und lng
我的 i18n trans yuml 被剪断了:
来源:
plugin: taxonomy_terms_i18n // custom source plugin to get translations
translations: true
destination:
plugin: entity:taxonomy_term
translations: true
process:
# to_db_value : from_db_value.
# d8_db_value : d7_db_value
tid:
plugin: migration_lookup
migration: // name of your previous migration of terms
source: tid
langcode:
plugin: default_value
default_value: es
vid:
plugin: skip_on_value
source: machine_name
method: row
value:
- // terms vid that you don't need
name:
plugin: skip_on_empty
method: row
source: translation
i18n 翻译查询的源文件截图:
$query = $this->select('taxonomy_term_data', 'term_data');
$query->join('taxonomy_vocabulary','vocabulary', 'term_data.vid = vocabulary.vid');
$query->leftJoin('i18n_string','i18n', 'term_data.tid = i18n.objectid');
$query->leftJoin('locales_target','locales', 'i18n.lid = locales.lid');
$query
->fields('term_data', [
'tid',
'vid',
'name',
'description',
'weight',
'format',
])
->fields('vocabulary', ['machine_name'])
->fields('locales', ['translation']);
【讨论】: