public function LocaleSource::getExistingLangCodes in Translation Management Tool 8
Gets existing translation language codes of the job item source.
Returns language codes that can be used as the source language for a translation job.
Parameters
\Drupal\tmgmt\JobItemInterface $job_item: The job item.
Return value
array Array of language codes.
Overrides SourcePluginBase::getExistingLangCodes
File
- sources/
locale/ src/ Plugin/ tmgmt/ Source/ LocaleSource.php, line 235
Class
- LocaleSource
- Translation Source plugin for locale strings.
Namespace
Drupal\tmgmt_locale\Plugin\tmgmt\SourceCode
public function getExistingLangCodes(JobItemInterface $job_item) {
$query = \Drupal::database()
->select('locales_target', 'lt');
$query
->fields('lt', array(
'language',
));
$query
->condition('lt.lid', $job_item
->getItemId());
$existing_lang_codes = array(
'en',
);
foreach ($query
->execute() as $language) {
$existing_lang_codes[] = $language->language;
}
return $existing_lang_codes;
}