Skip to content
Snippets Groups Projects
Commit 29155fdb authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #2970849 by quietone, phenaproxima: i18n Variable to config: user settings and user.mail

parent b4ece22a
No related branches found
No related tags found
No related merge requests found
id: d7_user_mail_translation
label: User mail configuration translation
migration_tags:
- Drupal 7
- Configuration
- Multilingual
source:
plugin: d7_variable_translation
variables:
- user_mail_cancel_confirm_subject
- user_mail_cancel_confirm_body
- user_mail_password_reset_subject
- user_mail_password_reset_body
- user_mail_register_admin_created_subject
- user_mail_register_admin_created_body
- user_mail_register_no_approval_required_subject
- user_mail_register_no_approval_required_body
- user_mail_register_pending_approval_subject
- user_mail_register_pending_approval_body
- user_mail_status_activated_subject
- user_mail_status_activated_body
- user_mail_status_blocked_subject
- user_mail_status_blocked_body
- user_mail_status_canceled_subject
- user_mail_status_canceled_body
process:
langcode: language
'cancel_confirm/subject':
plugin: convert_tokens
source: user_mail_cancel_confirm_subject
'cancel_confirm/body':
plugin: convert_tokens
source: user_mail_cancel_confirm_body
'password_reset/subject':
plugin: convert_tokens
source: user_mail_password_reset_subject
'password_reset/body':
plugin: convert_tokens
source: user_mail_password_reset_body
'register_admin_created/subject':
plugin: convert_tokens
source: user_mail_register_admin_created_subject
'register_admin_created/body':
plugin: convert_tokens
source: user_mail_register_admin_created_body
'register_no_approval_required/subject':
plugin: convert_tokens
source: user_mail_register_no_approval_required_subject
'register_no_approval_required/body':
plugin: convert_tokens
source: user_mail_register_no_approval_required_body
'register_pending_approval/subject':
plugin: convert_tokens
source: user_mail_register_pending_approval_subject
'register_pending_approval/body':
plugin: convert_tokens
source: user_mail_register_pending_approval_body
'status_activated/subject':
plugin: convert_tokens
source: user_mail_status_activated_subject
'status_activated/body':
plugin: convert_tokens
source: user_mail_status_activated_body
'status_blocked/subject':
plugin: convert_tokens
source: user_mail_status_blocked_subject
'status_blocked/body':
plugin: convert_tokens
source: user_mail_status_blocked_body
'status_canceled/subject':
plugin: convert_tokens
source: user_mail_status_canceled_subject
'status_canceled/body':
plugin: convert_tokens
source: user_mail_status_canceled_body
destination:
plugin: config
config_name: user.mail
translations: true
id: d7_user_settings_translation
label: User settings configuration translation
migration_tags:
- Drupal 7
- Configuration
- Multilingual
source:
plugin: d7_variable_translation
variables:
- anonymous
process:
langcode: language
anonymous: anonymous
destination:
plugin: config
config_name: user.settings
translations: true
<?php
namespace Drupal\Tests\config_translation\Kernel\Migrate\d7;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
/**
* Test migration of i18n user variables.
*
* @group migrate_drupal_7
*/
class MigrateUserConfigsTranslationTest extends MigrateDrupal7TestBase {
use SchemaCheckTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'language',
'locale',
'config_translation',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->installSchema('locale', [
'locales_source',
'locales_target',
'locales_location',
]);
$this->executeMigrations([
'd7_user_mail_translation',
'd7_user_settings_translation',
]);
}
/**
* Tests migration of i18n user variables to user.mail and user.settings.
*/
public function testUserConfig() {
// Tests migration of i18n user variables to user.mail.yml.
$language_manager = \Drupal::service('language_manager');
$config = $language_manager->getLanguageConfigOverride('is', 'user.mail');
$this->assertSame('is - Are you sure?', $config->get('cancel_confirm.subject'));
$this->assertSame('is - A little birdie said you wanted to cancel your account.', $config->get('cancel_confirm.body'));
$this->assertSame('is - Fix your password', $config->get('password_reset.subject'));
$this->assertSame("is - Nope! You're locked out forever.", $config->get('password_reset.body'));
$this->assertSame('is - Gawd made you an account', $config->get('register_admin_created.subject'));
$this->assertSame("is - ...and she could take it away.\r\n[site:name], [site:url]", $config->get('register_admin_created.body'));
$this->assertSame('is - Welcome!', $config->get('register_no_approval_required.subject'));
$this->assertSame('is - You can now log in if you can figure out how to use Drupal!', $config->get('register_no_approval_required.body'));
$this->assertSame('is - Soon...', $config->get('register_pending_approval.subject'));
$this->assertSame('is - ...you will join our Circle. Let the Drupal flow through you.', $config->get('register_pending_approval.body'));
$this->assertSame('is - Your account is approved!', $config->get('status_activated.subject'));
$this->assertSame('is - Your account was activated, and there was much rejoicing.', $config->get('status_activated.body'));
$this->assertSame('is - BEGONE!', $config->get('status_blocked.subject'));
$this->assertSame('is - You no longer please the robot overlords. Go to your room and chill out.', $config->get('status_blocked.body'));
$this->assertSame('is - So long, bub', $config->get('status_canceled.subject'));
$this->assertSame('is - The gates of Drupal are closed to you. Now you will work in the salt mines.', $config->get('status_canceled.body'));
$this->assertConfigSchema(\Drupal::service('config.typed'), 'user.mail', $config->get());
// Tests migration of i18n user variables to user.settings.yml.
$config = $language_manager->getLanguageConfigOverride('is', 'user.settings');
$this->assertSame('is - anonymous', $config->get('anonymous'));
}
}
......@@ -51539,6 +51539,139 @@
'value' => 'fr - The Slogan',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'en',
'name' => 'user_default_timezone',
'value' => '2',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'fr',
'name' => 'user_default_timezone',
'value' => '0',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_cancel_confirm_body',
'value' => 'is - A little birdie said you wanted to cancel your account.',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_cancel_confirm_subject',
'value' => 'is - Are you sure?',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_password_reset_body',
'value' => "is - Nope! You're locked out forever.",
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_password_reset_subject',
'value' => 'is - Fix your password',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_register_admin_created_body',
'value' => "is - ...and she could take it away.\r\n[site:name], [site:url]",
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_register_admin_created_subject',
'value' => 'is - Gawd made you an account',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_register_no_approval_required_body',
'value' => 'is - You can now log in if you can figure out how to use Drupal!',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_register_no_approval_required_subject',
'value' => 'is - Welcome!',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_register_pending_approval_body',
'value' => 'is - ...you will join our Circle. Let the Drupal flow through you.',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_register_pending_approval_subject',
'value' => 'is - Soon...',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_status_activated_body',
'value' => 'is - Your account was activated, and there was much rejoicing.',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_status_activated_subject',
'value' => 'is - Your account is approved!',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_status_blocked_body',
'value' => 'is - You no longer please the robot overlords. Go to your room and chill out.',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_status_blocked_subject',
'value' => 'is - BEGONE!',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_status_canceled_body',
'value' => 'is - The gates of Drupal are closed to you. Now you will work in the salt mines.',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'user_mail_status_canceled_subject',
'value' => 'is - So long, bub',
'serialized' => '0',
))
->values(array(
'realm' => 'language',
'realm_key' => 'is',
'name' => 'anonymous',
'value' => 'is - anonymous',
'serialized' => '0',
))
->execute();
 
$connection->schema()->createTable('watchdog', array(
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment