Skip to content
Snippets Groups Projects

2905295: prevent config language overrides on module install

Closes #2905295

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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() {
  • 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 = []) {
  • 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() {
  • shalini jha added 1 commit

    added 1 commit

    • 964c2ed1 - upadated the changes from comment

    Compare with previous version

  • 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);
  • shalini jha added 1 commit

    added 1 commit

    • a873099b - updated variable name from comment

    Compare with previous version

  • Joachim Noreiko added 138 commits

    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

    Compare with previous version

  • Joachim Noreiko added 2 commits

    added 2 commits

    • d47fa764 - Removed later setting of permission; module already enabled.
    • 4a2a20eb - Removed blank line.

    Compare with previous version

  • added 1 commit

    • b403d325 - Changed .po file import to be done using API.

    Compare with previous version

  • Joachim Noreiko added 3 commits

    added 3 commits

    • 0327f823 - Removed comments about module that's not enabled.
    • b811f83f - Fixed comment that seems incorrect.
    • 43c94f89 - Changed to use API for setting default language.

    Compare with previous version

  • Joachim Noreiko added 60 commits

    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.

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Please register or sign in to reply
    Loading