You are here

public function TestSource::getSourceLangCode in Translation Management Tool 8

Gets language code of the job item source.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: The job item.

Return value

string Language code.

Overrides SourcePluginInterface::getSourceLangCode

File

tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php, line 121

Class

TestSource
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Source

Code

public function getSourceLangCode(JobItemInterface $job_item) {
  $source_languages = \Drupal::state()
    ->get('tmgmt.test_source_languages', array());
  if (isset($source_languages[$job_item
    ->id()])) {
    return $source_languages[$job_item
      ->id()];
  }
  return 'en';
}