diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
index 8cd217b..460b5f7 100644
--- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleImportFunctionalTest.php
@@ -59,6 +59,7 @@ function testStandalonePoFile() {
// The import should have created 8 strings.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 8, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
// This import should have saved plural forms to have 2 variants.
$locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array();
@@ -75,6 +76,7 @@ function testStandalonePoFile() {
// The import should have created 1 string and rejected 2.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
$skip_message = format_plural(2, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => url('admin/reports/dblog')));
$this->assertRaw($skip_message, 'Unsafe strings were skipped.');
@@ -105,6 +107,7 @@ function testStandalonePoFile() {
// The import should have created 1 string.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
// Ensure string wasn't overwritten.
$search = array(
'string' => 'Montag',
@@ -127,6 +130,7 @@ function testStandalonePoFile() {
// The import should have updated 2 strings.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
// Ensure string was overwritten.
$search = array(
'string' => 'Montag',
@@ -147,6 +151,7 @@ function testStandalonePoFile() {
// The import should have created 6 strings.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 6, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
// The database should now contain 6 customized strings (two imported
// strings are not translated).
@@ -163,6 +168,7 @@ function testStandalonePoFile() {
// The import should have created 1 string.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The customized translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
// Ensure string wasn't overwritten.
$search = array(
'string' => 'januari',
@@ -182,6 +188,7 @@ function testStandalonePoFile() {
// The import should have updated 2 strings.
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The customized translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
// Ensure string was overwritten.
$search = array(
'string' => 'januari',
@@ -218,6 +225,7 @@ function testEmptyMsgstr() {
));
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
$this->assertIdentical(t('Operations', array(), array('langcode' => $langcode)), 'Műveletek', 'String imported and translated.');
// Try importing a .po file.
@@ -226,6 +234,7 @@ function testEmptyMsgstr() {
'overwrite_options[not_customized]' => TRUE,
));
$this->assertRaw(t('One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', array('%number' => 0, '%update' => 0, '%delete' => 1)), 'The translation file was successfully imported.');
+ $this->assertText(t('No configuration objects have been updated.'), 'No configuration translations updated.');
$str = "Operations";
$search = array(
diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc
index 8a7d547..1b606f4 100644
--- a/core/modules/locale/locale.bulk.inc
+++ b/core/modules/locale/locale.bulk.inc
@@ -110,6 +110,7 @@ function locale_translate_import_form($form, &$form_state) {
* Form submission handler for locale_translate_import_form().
*/
function locale_translate_import_form_submit($form, &$form_state) {
+ \Drupal::moduleHandler()->loadInclude('locale', 'translation.inc');
// Ensure we have the file uploaded.
if ($file = file_save_upload('file', $form['file']['#upload_validators'], 'translations://', 0)) {
@@ -122,14 +123,20 @@ function locale_translate_import_form_submit($form, &$form_state) {
$language = language_save($language);
drupal_set_message(t('The language %language has been created.', array('%language' => t($language->name))));
}
- $options = array(
+ $options = array_merge(_locale_translation_default_update_options(), array(
'langcode' => $form_state['values']['langcode'],
'overwrite_options' => $form_state['values']['overwrite_options'],
'customized' => $form_state['values']['customized'] ? LOCALE_CUSTOMIZED : LOCALE_NOT_CUSTOMIZED,
- );
+ ));
$file = locale_translate_file_attach_properties($file, $options);
$batch = locale_translate_batch_build(array($file->uri => $file), $options);
batch_set($batch);
+
+ // Create or update all configuration translations for this language.
+ \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc');
+ if ($batch = locale_config_batch_update_components($options, array($form_state['values']['langcode']))) {
+ batch_set($batch);
+ }
}
else {
form_set_error('file', t('File to import not found.'));