Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291765

Migrate i18ntaxonomy vocabulary settings

$
0
0

Problem/Motivation

On #2886609: Migrate D6 i18n loacalized translations of taxonomy terms, we found that vocabulary vocabulary settings from the i18n Taxonomy translation module are not being migrated.

On a D6 site with this module enabled, the Vocabulary page has a "Multilingual options" section of the settings that looks like this:
Multilingual vocabulary options screenshot

These configuration options are defined in D6 as follows. There's a form alter method in i18ntaxonomy.module around line 366 that adds this to the vocabulary form:

      $form['i18n'] = array(
        '#type' => 'fieldset',
        '#title' => t('Multilingual options'),
        '#collapsible' => TRUE,
        '#weight' => 0,
      );
      $form['i18n']['i18nmode'] = array(
        '#type' => 'radios',
        '#title' => t('Translation mode'),
        '#options' => _i18ntaxonomy_vocabulary_options(),
        '#default_value' => $mode,
        '#description' => t('For localizable vocabularies, to have all terms available for translation visit the <a href="@locale-refresh">translation refresh</a> page.', array('@locale-refresh' => url('admin/build/translate/refresh'))),
      );

This data is then saved in variable i18ntaxonomy_vocabulary. It looks like the structure is just an associative array of $vid => $mode and here are the mode options and constant values:

  // this is i18ntaxonomy_vocabulary_options():
  return array(
    I18N_TAXONOMY_NONE => t('None. No multilingual options for this vocabulary.'),
    I18N_TAXONOMY_LOCALIZE => t('Localize terms. Terms are common for all languages, but their name and description may be localized.'),
    I18N_TAXONOMY_TRANSLATE => t('Per language terms. Different terms will be allowed for each language and they can be translated.'),
    I18N_TAXONOMY_LANGUAGE => t('Set language to vocabulary. The vocabulary will have a global language and it will only show up for pages in that language.'),
  );

  // and the constants are defined as:

// No multilingual options
define('I18N_TAXONOMY_NONE', 0);
// Run through the localization system
define('I18N_TAXONOMY_LOCALIZE', 1);
// Predefined language for all terms
define('I18N_TAXONOMY_LANGUAGE', 2);
// Multilingual terms, translatable
define('I18N_TAXONOMY_TRANSLATE', 3);

Proposed resolution

The D6 i18n taxonomy support two fundamentally different concepts: 'Localized' and 'Per language terms'.

D6 'Localized' concept

The data model in D6 is illustrated in the picture below.
D6 'localized' concept

  • The node translations are separate nodes but they are both pointing to the same term.
  • There is only one term entity, but the title and description of the term can be translated in D6.

The D8 equivalent to this concept is shown in the picture below.
D8 shared term with translations

The D8 vocabulary settings are shown in the picture below. Do not pay attention to the values in the screenshot, pay attention to the mapping under the picture.
D8 vocabulary settings

Proposed resolution for D8 Vocabulary settings when using D6 'localized' concept:

  • D8 vocabulary language: Migrate from D6 vocabulary language. If empty on D6, migrate to 'und' (Not specified).
  • D8 Term default language: Migrate from D6 vocabulary language if it is set. Otherwise migrate to site default language. This does not impact the language of the terms to be migrated, only new terms that will be created in D8.
  • D8 'Show language selector on create and edit pages': TRUE
  • D8 'Enable translation': TRUE

D6 'per language' concept

The data model in D6 is illustrated in the picture below.
D6 'per language' concept

  • The node translations are separate nodes.
  • There are two separate term entities which may be linked together as translations of each other but the translation link does not necessarily exist.

The closest D8 equivalent to this concept is shown in the picture below.
D8 separate terms

Proposed resolution for D8 Vocabulary settings when using D6 'per language' concept:

  • D8 vocabulary language: Migrate from D6 vocabulary language. If empty on D6, migrate to 'und' (Not specified).
  • D8 Term default language: Migrate from D6 vocabulary language if it is set. Otherwise migrate to site default language. This does not impact the language of the terms to be migrated, only new terms that will be created in D8.
  • D8 'Show language selector on create and edit pages': TRUE
  • D8 'Enable translation': FALSE. These term entities are one per language in D6 so they must not be translatable with the D8 concept which is totally different than in D6.

Proposed resolution when using D6 'Set language to vocabulary' setting

  • D8 vocabulary language: Migrate from D6 vocabulary language. If empty on D6, migrate to 'und' (Not specified).
  • D8 Term default language: Migrate from D6 vocabulary language if it is set. Otherwise migrate to site default language. This does not impact the language of the terms to be migrated, only new terms that will be created in D8.
  • D8 'Show language selector on create and edit pages': FALSE
  • D8 'Enable translation': FALSE.

Proposed resolution when using D6 'No multilingual options for this vocabulary' setting

  • Migrate to 'zxx' (Not applicable).
  • D8 Term default language: Migrate from D6 vocabulary language if it is set. Otherwise migrate to site default language. This does not impact the language of the terms to be migrated, only new terms that will be created in D8.
  • D8 'Show language selector on create and edit pages': FALSE
  • D8 'Enable translation': FALSE.

Remaining tasks

1. Review and agree the configuration settings of the proposed resolution
2. Make a patch with tests.
3. Test manually.

User interface changes

N/A

API changes

N/A

Data model changes

N/A


Viewing all articles
Browse latest Browse all 291765

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>