Commit 7e120d9b authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #2970847 by quietone, phenaproxima: i18n Variable to config: system site settings [d7]

(cherry picked from commit 09021c59)
parent 1e5459eb
id: d7_system_site_translation
label: Site configuration translation
migration_tags:
- Drupal 7
- Configuration
- Multilingual
source:
plugin: d7_variable_translation
variables:
- site_name
- site_mail
- site_slogan
- site_frontpage
- site_403
- site_404
process:
langcode: language
name: site_name
mail: site_mail
slogan: site_slogan
'page/front': site_frontpage
'page/403': site_403
'page/404': site_404
destination:
plugin: config
config_name: system.site
translations: true
<?php
namespace Drupal\Tests\config_translation\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Migrate multilingual site variables.
*
* @group migrate_drupal_7
*/
class MigrateSystemSiteTranslationTest extends MigrateDrupal7TestBase {
/**
* {@inheritdoc}
*/
public static $modules = [
'language',
'config_translation',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->executeMigration('d7_system_site_translation');
}
/**
* Tests migration of system (site) variables to system.site.yml.
*/
public function testSystemSite() {
$language_manager = \Drupal::service('language_manager');
$config_translation = $language_manager->getLanguageConfigOverride('fr', 'system.site');
$this->assertSame('The Site Name', $config_translation->get('name'));
$this->assertSame('fr - The Slogan', $config_translation->get('slogan'));
$this->assertSame('node', $config_translation->get('page.403'));
$this->assertSame('node', $config_translation->get('page.404'));
$this->assertSame('node', $config_translation->get('page.front'));
$this->assertSame(NULL, $config_translation->get('admin_compact_mode'));
$config_translation = $language_manager->getLanguageConfigOverride('is', 'system.site');
$this->assertSame('is - The Site Name', $config_translation->get('name'));
$this->assertSame('is - The Slogan', $config_translation->get('slogan'));
$this->assertSame('node/1', $config_translation->get('page.403'));
$this->assertSame('node/6', $config_translation->get('page.404'));
$this->assertSame('node/4', $config_translation->get('page.front'));
$this->assertNULL($config_translation->get('admin_compact_mode'));
}
}
......@@ -51469,6 +51469,76 @@
'value' => 'is - This is a custom maintenance mode message.',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'site_403',
'value' => 'node/1',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'site_404',
'value' => 'node/6',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'site_frontpage',
'value' => 'node/4',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'site_name',
'value' => 'is - The Site Name',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'site_slogan',
'value' => 'is - The Slogan',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'fr',
'name' => 'site_403',
'value' => 'node',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'fr',
'name' => 'site_404',
'value' => 'node',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'fr',
'name' => 'site_frontpage',
'value' => 'node',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'fr',
'name' => 'site_name',
'value' => 'The Site Name',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'fr',
'name' => 'site_slogan',
'value' => 'fr - The Slogan',
'serialized' => '0',
))
->execute();
$connection->schema()->createTable('watchdog', array(
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment