Comments

penyaskito’s picture

Assigned: Unassigned » penyaskito
Status: Reviewed & tested by the community » Active

I will give a try.

penyaskito’s picture

Status: Active » Needs review
StatusFileSize
new8.52 KB

Languages are really special config entities. We have Language classes, and entity classes. Because of circular dependencies between language system and configuration, entities are only used for loading/saving into config system, but in runtime we use the Drupal\Core\Language\Language objects.

For this reason, we need to clear language_list cache. ATM I put that on the migration test, but ideally this should happen after import (I don't know if we have mechanisms for running something after migration execution). We probably need to do other things as well (update state()->language_count?

Also, this is incomplete because in D6 we had language negotiation information in the languages table, and now it is outside of the language entities.
#1862202: Objectify the language system is a big refactoring around language negotiation really close to land, so maybe we should open a follow-up for that and postpone it on that if we want to move this forward.

Tests for the language source plugin are still missing.

penyaskito’s picture

StatusFileSize
new12.21 KB
new4.27 KB

Included language source test.

penyaskito’s picture

Status: Needs review » Needs work

In the case of languages, we shouldn't use the machine_name plugin but just copy language to id.
If we install in English (en) and we execute a migration, we don't want a new language English(en1), but to override English(en) configuration.

The last submitted patch, 3: imp-2166875-languages-3.patch, failed testing.

penyaskito’s picture

3: imp-2166875-languages-3.patch queued for re-testing.

penyaskito’s picture

Status: Needs work » Needs review
StatusFileSize
new546 bytes
new12.17 KB

Change explained at #4: don't use machine_name but get the language id as is.

chx’s picture

Project: Drupal core » IMP
Version: 8.x-dev »
Component: migration system » Code

Where are we with this? A big patch went in but I think not all variables were yet converted to CMI.

penyaskito’s picture

With #7 language migration should work.
However, language config and language negotiation configuration is not taking place yet.

I would say that language config should happen in a different migration, maybe triggered by this one (or the opposite) for consistence.

About language negotiation settings, we should do that in another issue, not sure if it will affect this migration or will be a completely new one. Anyway that would be postponed on #1862202: Objectify the language system.

penyaskito’s picture

penyaskito’s picture

Status: Postponed » Needs work

I guess this is doable now.

penyaskito’s picture

penyaskito’s picture

StatusFileSize
new12.3 KB
new4.91 KB

Updated the language migration after the changes in the last weeks.
The current patch still is red.

penyaskito’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new1009 bytes
new12.39 KB

The problem was with the clearing of language caches.
I added a core issue #2234623: Move language add logic out of language_save() and marked here with a ToDo.

penyaskito’s picture

StatusFileSize
new12.24 KB
new766 bytes

Added a patch in the core issue, which is not green yet but makes this one pass without clearing language caches.

Anonymous’s picture

Issue tags: +imp, +sprint, +D8MI
Anonymous’s picture

I applied this patch and the patch to language_save() and this stuff is now working! Yay!

One note though: I was looking in core/modules/migrate_drupal/migrate.config.yml for the names of the migrations not realizing the id for this was not in the listing there.

I have made a blog post for how to boostrap yourself to the point where you can test this here: http://www.verbosity.ca/migrating-multilingual-data-drupal-8

PS. I would RTBC this, but I think we should wait on the other issue. So if you feel the need to do so, here is my vote... :)

Anonymous’s picture

The import of the languages requires that Drupal 8 be installed in English. If you install it in French it will not install English.

This may be a discrepancy between the site configs:

D6: default language EN
D8: default language FR = Fail

D6: default language EN
D8: default language EN = Pass

Anonymous’s picture

Regarding the comment above, path prefixes did not come through (noted in #2225293: Migrate D6 and D7 language negotiation settings). My D6 source site has prefixes set for both EN and FR.

Anonymous’s picture

Status: Needs review » Needs work
penyaskito’s picture

StatusFileSize
new12.26 KB

New patch. The only difference is moving the migration to config/install, no interdiff attached.

penyaskito’s picture

Comment #18... not sure what we should do. I guess we can document that config migrations should be run on install? Should we create English always ìnstead as it was in D6 and D7?

Comment #19 should be take care of in #2225293: Migrate D6 and D7 language negotiation settings.

gábor hojtsy’s picture

@penyaskito: I'm not sure we can create English at all times, but that may be best. Drupal 6/7 had the concept of disabled languages, while D8 does not. Most sites that did not need English disabled it. Unfortunately i18n module exposed disabled languages as kind of an in-site translation staging solution. So there may or may not be items on the site in the disabled languages. So at the end, it may be best to create all languages even disabled one in the D8 migration. I don't know but if there is a migration log kept, that log should contain hints to review the languages after the migration due to this.

chx’s picture

Migration log is being discussed right now, talk to mikeryan for more. (Also hi @Gábor Hojtsy in the IMP sandbox!)

penyaskito’s picture

StatusFileSize
new5.91 KB
new13.78 KB

Overriden runQuery() for adding English if not present at the sources time and using ArrayIterator instead.

Changed test languages for avoiding English there. Anyway, the current tests don't test this behavior, as the tests installation is always done in English so that's why English is present. Needs manual testing.

This will fail per #2272219: Use iterator_count() instead of count() in MigrateTestCase::queryResultTest, still investigating.

sutharsan’s picture

Project: IMP » Drupal core
Version: » 8.x-dev
Component: Code » migration system
Status: Needs work » Needs review
StatusFileSize
new13.49 KB

Moving to the issue to drupal core. (correct me if I'm wrong)
Re-rolling the patch for PSR-4 changes.

Status: Needs review » Needs work

The last submitted patch, 26: 2166875-migrate-languages-26.patch, failed testing.

sutharsan’s picture

Project: Drupal core » IMP
Version: 8.x-dev »
Component: migration system » Code

Moving back to IMP issue queue after IRC discussion with Penyaskito.

penyaskito’s picture

StatusFileSize
new13.17 KB
new6.49 KB

Now it is green, it needed to override count() in Drupal\migrate_drupal\Plugin\migrate\source\d6\Language.

  • penyaskito committed 194d1c4 on drupal6-i18n
    Issue #2166875 by penyaskito, Sutharsan: Migrate D6 languages.
    
penyaskito’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.