Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x

TranslatorInterface.php

Same filename in this branch
  1. 11.1.x vendor/php-tuf/composer-stager/src/API/Translation/Service/TranslatorInterface.php
  2. 11.1.x vendor/symfony/css-selector/XPath/TranslatorInterface.php
  3. 11.1.x vendor/symfony/translation-contracts/TranslatorInterface.php
  4. 11.1.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.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal