function install_find_translations
install_find_translations()
Finds all .po files that are useful to the installer.
Return value
An associative array of file URIs keyed by language code. URIs as returned by file_scan_directory().
See also
File
- core/includes/install.core.inc, line 1243
- API functions for installing Drupal.
Code
function install_find_translations() { $translations = array(); $files = \Drupal::service('string_translator.file_translation')->findTranslationFiles(); // English does not need a translation file. array_unshift($files, (object) array('name' => 'en')); foreach ($files as $uri => $file) { // Strip off the file name component before the language code. $langcode = preg_replace('!^(.+\.)?([^\.]+)$!', '\2', $file->name); // Language codes cannot exceed 12 characters to fit into the {language} // table. if (strlen($langcode) <= 12) { $translations[$langcode] = $uri; } } return $translations; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!install.core.inc/function/install_find_translations/8.1.x