class CustomStrings in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php \Drupal\Core\StringTranslation\Translator\CustomStrings
String translator using overrides from variables.
This is a high performance way to provide a handful of string replacements. See settings.php for examples.
Hierarchy
- class \Drupal\Core\StringTranslation\Translator\StaticTranslation implements TranslatorInterface
- class \Drupal\Core\StringTranslation\Translator\CustomStrings
Expanded class hierarchy of CustomStrings
1 string reference to 'CustomStrings'
- core.services.yml in core/
core.services.yml - core/core.services.yml
1 service uses CustomStrings
File
- core/
lib/ Drupal/ Core/ StringTranslation/ Translator/ CustomStrings.php, line 18 - Contains \Drupal\Core\StringTranslation\Translator\CustomStrings.
Namespace
Drupal\Core\StringTranslation\TranslatorView source
class CustomStrings extends StaticTranslation {
/**
* The settings read only object.
*
* @var \Drupal\Core\Site\Settings
*/
protected $settings;
/**
* Constructs a CustomStrings object.
*
* @param \Drupal\Core\Site\Settings $settings
* The settings read only object.
*/
public function __construct(Settings $settings) {
parent::__construct();
$this->settings = $settings;
}
/**
* {@inheritdoc}
*/
protected function getLanguage($langcode) {
return $this->settings
->get('locale_custom_strings_' . $langcode, array());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CustomStrings:: |
protected | property | The settings read only object. | |
CustomStrings:: |
protected | function |
Add translations for new language. Overrides StaticTranslation:: |
|
CustomStrings:: |
public | function |
Constructs a CustomStrings object. Overrides StaticTranslation:: |
|
StaticTranslation:: |
protected | property | String translations | |
StaticTranslation:: |
public | function |
Retrieves English string to given language. Overrides TranslatorInterface:: |
|
StaticTranslation:: |
public | function |
Resets translation cache. Overrides TranslatorInterface:: |