You are here

class InterfaceTranslationRecorder in Localization client 8

String translation listener to collect data.

Hierarchy

Expanded class hierarchy of InterfaceTranslationRecorder

1 string reference to 'InterfaceTranslationRecorder'
l10n_client_ui.services.yml in l10n_client_ui/l10n_client_ui.services.yml
l10n_client_ui/l10n_client_ui.services.yml
1 service uses InterfaceTranslationRecorder
string_translator.l10n_client_ui in l10n_client_ui/l10n_client_ui.services.yml
Drupal\l10n_client_ui\InterfaceTranslationRecorder

File

l10n_client_ui/src/InterfaceTranslationRecorder.php, line 10

Namespace

Drupal\l10n_client_ui
View source
class InterfaceTranslationRecorder implements TranslatorInterface {

  /**
   * String that were attempted to be looked up in this request.
   *
   * @var array
   */
  protected $strings = array();

  /**
   * @inheritdoc
   */
  public function getStringTranslation($langcode, $string, $context) {
    if ($langcode != 'en' || locale_is_translatable('en')) {
      $this->strings[$langcode][$context][$string] = TRUE;
    }
    return FALSE;
  }

  /**
   * @inheritdoc
   */
  public function reset() {
    $this->strings = array();
  }

  /**
   * @inheritdoc
   *
   * @return array
   *   Array of strings keyed by language code and context.
   */
  public function getRecordedData() {
    return $this->strings;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InterfaceTranslationRecorder::$strings protected property String that were attempted to be looked up in this request.
InterfaceTranslationRecorder::getRecordedData public function @inheritdoc
InterfaceTranslationRecorder::getStringTranslation public function @inheritdoc Overrides TranslatorInterface::getStringTranslation
InterfaceTranslationRecorder::reset public function @inheritdoc Overrides TranslatorInterface::reset