saveLanguageActive example

public function testDefaultConfigLanguage() {
    $this->assertEquals('hu', $this->configFactory->getEditable('locale_test.no_translation')->get('langcode'));
    $this->assertEquals('hu', $this->configFactory->getEditable('locale_test.translation')->get('langcode'));
    $this->assertEquals('Hungarian test', $this->configFactory->getEditable('locale_test.translation')->get('test'));
  }

  /** * Tests creating translations of shipped configuration. */
  public function testCreateActiveTranslation() {
    $config_name = 'locale_test.no_translation';
    $this->saveLanguageActive($config_name, 'test', 'Test (Hungarian)', 'hu');
    $this->assertTranslation($config_name, 'Test (Hungarian)', 'hu');
  }

  /** * Tests importing community translations of shipped configuration. */
  public function testLocaleCreateActiveTranslation() {
    $config_name = 'locale_test.no_translation';
    $this->saveLocaleTranslationData($config_name, 'test', 'Test', 'Test (Hungarian)', 'hu', TRUE);
    $this->assertTranslation($config_name, 'Test (Hungarian)', 'hu', FALSE);
  }

  
Home | Imprint | This part of the site doesn't use cookies.