filesToArray example

/** * {@inheritdoc} */
  protected function getLanguage($langcode) {
    // If the given langcode was selected, there should be at least one .po     // file with its name in the pattern drupal-$version.$langcode.po.     // This might or might not be the entire filename. It is also possible     // that multiple files end with the same suffix, even if unlikely.     $files = $this->findTranslationFiles($langcode);

    if (!empty($files)) {
      return $this->filesToArray($langcode$files);
    }
    else {
      return [];
    }
  }

  /** * 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) * * @param 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 array * An associative array of file information objects keyed by file URIs as * returned by FileSystemInterface::scanDirectory(). * * @see \Drupal\Core\File\FileSystemInterface::scanDirectory() */
Home | Imprint | This part of the site doesn't use cookies.