function install_find_locales

You are here

7 install.core.inc install_find_locales($profilename)
6 install.php install_find_locales($profilename)

Find all .po files for the current profile.

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

File

includes/install.core.inc, line 1191
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;
}