You are here

public function TMGMTLocaleSourcePluginController::getExistingLangCodes in Translation Management Tool 7

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

TMGMTJobItem $job_item: The job item.

Return value

array Array of language codes.

Overrides TMGMTDefaultSourcePluginController::getExistingLangCodes

File

sources/locale/tmgmt_locale.plugin.inc, line 232
Provides the locale source controller.

Class

TMGMTLocaleSourcePluginController
Translation plugin controller for locale strings.

Code

public function getExistingLangCodes(TMGMTJobItem $job_item) {
  $query = db_select('locales_target', 'lt');
  $query
    ->fields('lt', array(
    'language',
  ));
  $query
    ->condition('lt.lid', $job_item->item_id);
  $existing_lang_codes = array(
    'en',
  );
  foreach ($query
    ->execute() as $language) {
    $existing_lang_codes[] = $language->language;
  }
  return $existing_lang_codes;
}