TranslatorInterface.php

Same filename in this branch
  1. 9 core/lib/Drupal/Core/Validation/TranslatorInterface.php
Same filename in other branches
  1. 8.9.x core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php
  2. 8.9.x core/lib/Drupal/Core/Validation/TranslatorInterface.php
  3. 10 core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php
  4. 10 core/lib/Drupal/Core/Validation/TranslatorInterface.php
  5. 11.x core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php
  6. 11.x core/lib/Drupal/Core/Validation/TranslatorInterface.php

Namespace

Drupal\Core\StringTranslation\Translator

File

core/lib/Drupal/Core/StringTranslation/Translator/TranslatorInterface.php

View source
<?php

namespace Drupal\Core\StringTranslation\Translator;


/**
 * Interface for objects capable of string translation.
 */
interface TranslatorInterface {
    
    /**
     * Retrieves English string to given language.
     *
     * @param string $langcode
     *   Language code to translate to.
     * @param string $string
     *   The source string.
     * @param string $context
     *   The string context.
     *
     * @return string|false
     *   Translated string if there is a translation, FALSE if not.
     */
    public function getStringTranslation($langcode, $string, $context);
    
    /**
     * Resets translation cache.
     *
     * Since most translation systems implement some form of caching, this
     * provides a way to delete that cache.
     */
    public function reset();

}

Interfaces

Title Deprecated Summary
TranslatorInterface Interface for objects capable of string translation.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.