$this->
importPoFile($this->
getPoFile(),
[ 'langcode' => 'fr',
]);
$this->
config('locale.settings'
);
// The import should automatically create the corresponding language.
$this->
assertSession()->
pageTextContains("The language French has been created."
);
// The import should have created 8 strings.
$this->
assertSession()->
pageTextContains("One translation file imported. 8 translations were added, 0 translations were updated and 0 translations were removed."
);
// This import should have saved plural forms to have 2 variants.
$locale_plurals = \Drupal::
service('locale.plural.formula'
)->
getNumberOfPlurals('fr'
);
$this->
assertEquals(2,
$locale_plurals, 'Plural number initialized.'
);
// Ensure we were redirected correctly.
$this->
assertSession()->
addressEquals(Url::
fromRoute('locale.translate_page'
));
// Try importing a .po file with invalid tags.
$this->
importPoFile($this->
getBadPoFile(),
[ 'langcode' => 'fr',
]);
// The import should have created 1 string and rejected 2.