public function DrushLanguageCommands::importTranslations in Drush Language Commands 8
Import a single .po file.
@command language:import:translations
@option langcode Language code to be imported. If not given, extracted from file name. @option replace-customized Replace existing customized translations. Defaults to true. @option replace-not-customized Replace existing not-customized translations. Defaults to true. @option set-customized Set all existing translations as being customized. Defaults to true. @option autocreate-language Autocreate any imported language if it does not yet exist. Defaults to true.
@usage drush langimp Import all custom translations from the directory defined in $settings['custom_translations_directory']. @usage drush langimp --langcode=ru file.po Import single file with explicit langcode. @usage drush langimp --langcode=eo --no-set-customized --no-replace-customized de.po foomodule.fr.po barmodule-8.x-2.2-rc1.es.po Import not-customized (e.g. module) translations, without replacing custom translations, with auto langcode (these are the recognized patterns)'.
@aliases langimp,language-import,language-import-translations
Parameters
array $poFiles: Comma-separated list of paths .po files containing the translations.
File
- src/
Commands/ DrushLanguageCommands.php, line 98
Class
- DrushLanguageCommands
- Implements the Drush language commands.
Namespace
Drupal\drush_language\CommandsCode
public function importTranslations(array $poFiles, array $options = [
'langcode' => NULL,
'replace-customized' => TRUE,
'replace-not-customized' => TRUE,
'set-customized' => TRUE,
'autocreate-language' => TRUE,
]) {
$poFiles = StringUtils::csvToArray($poFiles);
$this->cliService
->importTranslations($this
->io(), 'dt', $poFiles, $options);
}