function FileTranslation::getTranslationFilesPattern

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::getTranslationFilesPattern()
  2. 10 core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::getTranslationFilesPattern()
  3. 11.x core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php \Drupal\Core\StringTranslation\Translator\FileTranslation::getTranslationFilesPattern()

Provides translation file name pattern.

Parameters

string $langcode: (optional) The language code corresponding to the language for which we want to find translation files.

Return value

string String file pattern.

1 call to FileTranslation::getTranslationFilesPattern()
FileTranslation::findTranslationFiles in core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php
Finds installer translations either for a specific or all languages.

File

core/lib/Drupal/Core/StringTranslation/Translator/FileTranslation.php, line 102

Class

FileTranslation
File based string translation.

Namespace

Drupal\Core\StringTranslation\Translator

Code

protected function getTranslationFilesPattern($langcode = NULL) {
    // The file name matches: drupal-[release version].[language code].po
    // When provided the $langcode is use as language code. If not provided all
    // language codes will match.
    return '!drupal-[0-9]+\\.[0-9]+\\.([0-9]+|x)(-[a-z]+[0-9]*)?\\.' . (!empty($langcode) ? preg_quote($langcode, '!') : LanguageInterface::VALID_LANGCODE_REGEX) . '\\.po$!';
}

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