You are here

protected function FileTranslation::getTranslationFilesPattern in Drupal 9

Same name and namespace in other branches
  1. 8 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$!';
}