function FileTranslation::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::__construct()
- 10 core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::__construct()
- 11.x core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::__construct()
Constructs a StaticTranslation object.
Parameters
string $directory: The directory to retrieve file translations from.
\Drupal\Core\File\FileSystemInterface $file_system: The file system service.
Overrides StaticTranslation::__construct
File
-
core/
lib/ Drupal/ Core/ StringTranslation/ Translator/ FileTranslation.php, line 42
Class
- FileTranslation
- File based string translation.
Namespace
Drupal\Core\StringTranslation\TranslatorCode
public function __construct($directory, FileSystemInterface $file_system = NULL) {
parent::__construct();
$this->directory = $directory;
if (!isset($file_system)) {
@trigger_error('Calling FileTranslation::__construct() without the $file_system argument is deprecated in drupal:8.8.0. The $file_system argument will be required in drupal:9.0.0. See https://www.drupal.org/node/3038437', E_USER_DEPRECATED);
$file_system = \Drupal::service('file_system');
}
$this->fileSystem = $file_system;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.