function FileTranslation::findTranslationFiles
Same name in other branches
- 9 core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::findTranslationFiles()
- 10 core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::findTranslationFiles()
- 11.x core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::findTranslationFiles()
Finds installer translations either for a specific or all languages.
Filenames must match the pattern:
- 'drupal-[version].[langcode].po (if langcode is provided)
- 'drupal-[version].*.po (if no langcode is provided)
Parameters
string $langcode: (optional) The language code corresponding to the language for which we want to find translation files. If omitted, information on all available files will be returned.
Return value
array An associative array of file information objects keyed by file URIs as returned by FileSystemInterface::scanDirectory().
See also
\Drupal\Core\File\FileSystemInterface::scanDirectory()
1 call to FileTranslation::findTranslationFiles()
- FileTranslation::getLanguage in core/
lib/ Drupal/ Core/ StringTranslation/ Translator/ FileTranslation.php - Retrieves translations for a given language.
File
-
core/
lib/ Drupal/ Core/ StringTranslation/ Translator/ FileTranslation.php, line 88
Class
- FileTranslation
- File based string translation.
Namespace
Drupal\Core\StringTranslation\TranslatorCode
public function findTranslationFiles($langcode = NULL) {
$files = [];
if (is_dir($this->directory)) {
$files = $this->fileSystem
->scanDirectory($this->directory, $this->getTranslationFilesPattern($langcode), [
'recurse' => FALSE,
]);
}
return $files;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.