You are here

public function DrushLanguageCommands::exportTranslations in Drush Language Commands 8

Export string of a language as one or more .po files.

@command language:export:translations

@option statuses The statuses to export, defaults to 'customized'. This can be a comma-separated list of 'customized', 'not-customized', 'not-translated', or (as abbreviation) 'all'. @option langcodes The language codes to export, comma-separated. Defaults to all enabled languages. @option file The target file pattern. You can use %langcode as placeholder. Defaults to "%language.po". If the path is relative and does not start with ".", $settings[\'custom_translations_directory\'] must be defined and the path is relative to that directory. @option force Write file even if no translations. Defaults to true.

@usage drush langexp Export all custom translations into the directory defined in $settings['custom_translations_directory']. @usage drush langexp --langcodes=de --status=customized,not-customized --file=all-de.po Export all german translated strings @usage drush langexp --status=untranslated --file=./todo-%langcode.po Export untranslated strings from all languages to current dir

@aliases langexp,language-export,language-export-translations

File

src/Commands/DrushLanguageCommands.php, line 145

Class

DrushLanguageCommands
Implements the Drush language commands.

Namespace

Drupal\drush_language\Commands

Code

public function exportTranslations($options = [
  'statuses' => [
    'customized',
  ],
  'langcodes' => [],
  'file' => '%langcode.po',
  'force' => TRUE,
]) {
  try {
    $this->cliService
      ->exportTranslations($this
      ->io(), 'dt', $options);
  } catch (\Exception $exception) {
  }
}