function install_find_locales

Same name and namespace in other branches
  1. 6.x drupal-6.x/install.php \install_find_locales()

Find all .po files for the current profile.

1 call to install_find_locales()
install_select_locale in drupal-7.x/includes/install.core.inc
Installation task; select which locale to use for the current profile.

Archivo

drupal-7.x/includes/install.core.inc, line 1176
API functions for installing Drupal.

Código

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;
}