function install_find_locales

install_find_locales($profilename)

Find all .po files for the current profile.

File

includes/install.core.inc, line 1203
API functions for installing Drupal.

Code

function install_find_locales($profilename) {
  $locales = file_scan_directory('./profiles/' . $profilename . '/translations', '/\.po$/', array('recurse' => FALSE));
  array_unshift($locales, (object) array('name' => 'en'));
  foreach ($locales as $key => $locale) {
    // The locale (file name) might be drupal-7.2.cs.po instead of cs.po.
    $locales[$key]->langcode = preg_replace('!^(.+\.)?([^\.]+)$!', '\2', $locale->name);
    // Language codes cannot exceed 12 characters to fit into the {languages}
    // table.
    if (strlen($locales[$key]->langcode) > 12) {
      unset($locales[$key]);
    }
  }
  return $locales;
}

© 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/includes!install.core.inc/function/install_find_locales/7.x