Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.

This commit is contained in:
Pantheon Automation 2015-11-17 13:42:33 -08:00 committed by Greg Anderson
parent 4afb23bbd3
commit 7784f4c23d
929 changed files with 19798 additions and 5304 deletions

View file

@ -78,6 +78,10 @@ class LocaleConfigTranslationImportTest extends WebTestBase {
$this->container->get('module_installer')->install(['block', 'config_translation']);
$this->resetAll();
// The testing profile overrides locale.settings to disable translation
// import. Test that this override is in place.
$this->assertFalse($this->config('locale.settings')->get('translation.import_enabled'), 'Translations imports are disabled by default in the Testing profile.');
$admin_user = $this->drupalCreateUser(array('administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'administer permissions', 'translate configuration'));
$this->drupalLogin($admin_user);

View file

@ -144,6 +144,66 @@ class LocalePluralFormatTest extends WebTestBase {
}
}
/**
* Tests plural editing of DateFormatter strings
*/
public function testPluralEditDateFormatter() {
// Import some .po files with formulas to set up the environment.
// These will also add the languages to the system.
$this->importPoFile($this->getPoFileWithSimplePlural(), array(
'langcode' => 'fr',
));
// Set French as the site default language.
$this->config('system.site')->set('default_langcode', 'fr')->save();
// Visit User Info page before updating translation strings.
$this->drupalGet('user');
// Member for time should be translated.
$this->assertText("seconde", "'Member for' text is translated.");
$path = 'admin/config/regional/translate/';
$search = array(
'langcode' => 'fr',
// Limit to only translated strings to ensure that database ordering does
// not break the test.
'translation' => 'translated',
);
$this->drupalPostForm($path, $search, t('Filter'));
// Plural values for the langcode fr.
$this->assertText('@count seconde');
$this->assertText('@count secondes');
// Inject a plural source string to the database. We need to use a specific
// langcode here because the language will be English by default and will
// not save our source string for performance optimization if we do not ask
// specifically for a language.
\Drupal::translation()->formatPlural(1, '1 second', '@count seconds', array(), array('langcode' => 'fr'))->render();
$lid = db_query("SELECT lid FROM {locales_source} WHERE source = :source AND context = ''", array(':source' => "1 second" . LOCALE_PLURAL_DELIMITER . "@count seconds"))->fetchField();
// Look up editing page for this plural string and check fields.
$search = array(
'string' => '1 second',
'langcode' => 'fr',
);
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
// Save complete translations for the string in langcode fr.
$edit = array(
"strings[$lid][translations][0]" => '1 seconde updated',
"strings[$lid][translations][1]" => '@count secondes updated',
);
$this->drupalPostForm($path, $edit, t('Save translations'));
// User interface input for translating seconds should not be duplicated
$this->assertUniqueText('@count seconds', 'Interface translation input for @count seconds only appears once.');
// Member for time should be translated.
$this->drupalGet('user');
$this->assertText("seconde", "'Member for' text is translated.");
}
/**
* Tests plural editing and export functionality.
*/
@ -308,6 +368,11 @@ msgid_plural "@count hours"
msgstr[0] "@count heure"
msgstr[1] "@count heures"
msgid "1 second"
msgid_plural "@count seconds"
msgstr[0] "@count seconde"
msgstr[1] "@count secondes"
msgid "Monday"
msgstr "lundi"
EOF;