$this->
config('locale.settings'
) ->
set('translation.import_enabled', TRUE
) ->
set('translation.use_source', LOCALE_TRANSLATION_USE_SOURCE_LOCAL
) ->
save();
} /**
* Tests import of standalone .po files.
*/
public function testStandalonePoFile() { // Try importing a .po file.
$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'
);