【问题标题】:Drupal 7 to Drupal 8: migrate taxonomy with translation (i18n)?Drupal 7 到 Drupal 8:迁移分类法与翻译 (i18n)?
【发布时间】:2018-08-23 00:15:04
【问题描述】:

Drupal 7 到 Drupal 8 的迁移。我已迁移源语言中的术语,但无法迁移术语的翻译 (i18n) - 名称和描述。

我创建了一个自定义源插件,我在其中创建了带有分类名称和描述翻译的新字段。

那么如何迁移术语翻译? D6 示例不起作用。

谢谢。

【问题讨论】:

    标签: drupal drupal-8 drupal-taxonomy


    【解决方案1】:

    您可以使用FEEDS MODULE 导入分类、节点、用户、产品、自定义块、段落、自定义菜单链接

    为了导入字段的多个值,您还需要调用模块 FEEDS TAMPER.

    【讨论】:

      【解决方案2】:

      您可以在完全迁移您的分类后执行这些步骤(无需翻译):

      1. 安装语言 - https://www.drupal.org/docs/8/multilingual/install-a-language
      2. 为迁移创建一个模块(以节点为例):https://github.com/evolvingweb/migrate_example_i18n
      3. 编写迁移源插件(节点示例):https://github.com/evolvingweb/migrate_example_i18n/blob/8.x/src/Plugin/migrate/source/D7NodeEntityTranslation.php
      4. 使用“映射”编写 YUML 文件(节点示例):https://github.com/evolvingweb/migrate_example_i18n/blob/8.x/config/install/migrate_plus.migration.example_dog_i18n.yml
      5. 在命令行提示符下,在项目文件夹中执行以下命令: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']);
      

      更多信息: https://events.drupal.org/sites/default/files/slides/Migrating%20Multilingual%20Content%20to%20Drupal%208.pdf

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-04-02
        • 2019-04-15
        • 2016-12-30
        • 2023-03-23
        • 2018-10-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多