2905295: prevent config language overrides on module install
4 open threads
Closes #2905295
Merge request reports
Activity
22 /** 23 * {@inheritdoc} 24 */ 25 protected $defaultTheme = 'stark'; 26 27 /** 28 * {@inheritdoc} 29 */ 30 protected function setUp(): void { 31 parent::setUp(); 32 } 33 34 /** 35 * Tests configuration translations after any module/theme install. 36 */ 37 public function testConfigTranslationImport() { changed this line in version 3 of the diff
79 // Test this book config edit page for translation overrides or not. 80 $this->drupalGet('admin/structure/types/manage/book'); 81 $this->drupalGet('/en/admin/structure/types/manage/book'); 82 $this->assertSession()->fieldValueEquals('name', 'Book page'); 83 84 } 85 86 /** 87 * Helper function: import a standalone .po file in a given language. 88 * 89 * @param string $contents 90 * Contents of the .po file to import. 91 * @param array $options 92 * (optional) Additional options to pass to the translation import form. 93 */ 94 public function importPoFile($contents, array $options = []) { changed this line in version 3 of the diff
92 * (optional) Additional options to pass to the translation import form. 93 */ 94 public function importPoFile($contents, array $options = []) { 95 $file_system = \Drupal::service('file_system'); 96 $name = $file_system->tempnam('temporary://', "po_") . '.po'; 97 file_put_contents($name, $contents); 98 $options['files[file]'] = $name; 99 $this->drupalGet('admin/config/regional/translate/import'); 100 $this->submitForm($options, 'Import'); 101 $file_system->unlink($name); 102 } 103 104 /** 105 * Helper function that returns a .po file with configuration translations. 106 */ 107 public function getPoFileWithConfigDe() { 667 671 $config = $this->configFactory->reset($name)->getEditable($name); 668 672 // Should only update if still exists in active configuration. If locale 669 673 // module is enabled later, then some configuration may not exist anymore. 674 // Config will only be overridden if shipped language code is not available. 670 675 if (!$config->isNew()) { 671 676 $langcode = $config->get('langcode'); 672 if (empty($langcode) || $langcode == 'en') { 677 $isAvailableLangcode = in_array($langcode, $available_langcodes); changed this line in version 4 of the diff
added 138 commits
-
a873099b...fd75fa21 - 134 commits from branch
project:11.x
- 47c9420a - 2905295: prevent config language overrides on module install
- 988e00b4 - fixed phpcs reported issues
- a79a2720 - upadated the changes from comment
- 022c624e - updated variable name from comment
Toggle commit list-
a873099b...fd75fa21 - 134 commits from branch
added 1 commit
- b403d325 - Changed .po file import to be done using API.
added 60 commits
-
43c94f89...56bf8c1f - 50 commits from branch
project:11.x
- 3ae64296 - 2905295: prevent config language overrides on module install
- 533d04c6 - fixed phpcs reported issues
- 327080ea - upadated the changes from comment
- 6615488c - updated variable name from comment
- 7efaf401 - Removed later setting of permission; module already enabled.
- 7614a204 - Removed blank line.
- d798360f - Changed .po file import to be done using API.
- 5a46325b - Removed comments about module that's not enabled.
- 40e2777d - Fixed comment that seems incorrect.
- 517e3306 - Changed to use API for setting default language.
Toggle commit list-
43c94f89...56bf8c1f - 50 commits from branch
Please register or sign in to reply