From 52ba5cc84c0d6e47913392a1df666b8b6cd27952 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 28 Dec 2010 18:17:27 +0000 Subject: =?UTF-8?q?#994500=20by=20G=C3=A1bor=20Hojtsy:=20Fixed=20Drupal=20?= =?UTF-8?q?should=20not=20require=20.po=20file=20rename=20in=20installatio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/install.core.inc | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'includes/install.core.inc') diff --git a/includes/install.core.inc b/includes/install.core.inc index 5a0892ce2..1acb78fd2 100644 --- a/includes/install.core.inc +++ b/includes/install.core.inc @@ -1120,6 +1120,10 @@ function install_select_profile_form($form, &$form_state, $profile_files) { 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); + } return $locales; } @@ -1145,8 +1149,8 @@ function install_select_locale(&$install_state) { if (!empty($_POST['locale'])) { foreach ($locales as $locale) { - if ($_POST['locale'] == $locale->name) { - $install_state['parameters']['locale'] = $locale->name; + if ($_POST['locale'] == $locale->langcode) { + $install_state['parameters']['locale'] = $locale->langcode; return; } } @@ -1164,14 +1168,6 @@ function install_select_locale(&$install_state) { $output = '

Follow these steps to translate Drupal into your language:

'; $output .= '
    '; $output .= '
  1. Download a translation from the translation server.
  2. '; - $output .= '
  3. Rename the downloaded file retaining only the language code at the end of the file name and its extension. For example, if the file name is -
    -drupal-7.0.pt-br.po
    -
    -rename it to -
    -pt-br.po
    -
  4. '; $output .= '
  5. Place it into the following directory:
     /profiles/' . $profilename . '/translations/
    @@ -1237,16 +1233,15 @@ function install_select_locale_form($form, &$form_state, $locales, $profilename)
       include_once DRUPAL_ROOT . '/includes/iso.inc';
       $languages = _locale_get_predefined_list();
       foreach ($locales as $locale) {
    -    // Try to use verbose locale name.
    -    $name = $locale->name;
    +    $name = $locale->langcode;
         if (isset($languages[$name])) {
           $name = $languages[$name][0] . (isset($languages[$name][1]) ? ' ' . st('(@language)', array('@language' => $languages[$name][1])) : '');
         }
    -    $form['locale'][$locale->name] = array(
    +    $form['locale'][$locale->langcode] = array(
           '#type' => 'radio',
    -      '#return_value' => $locale->name,
    -      '#default_value' => $locale->name == 'en' ? 'en' : '',
    -      '#title' => $name . ($locale->name == 'en' ? ' ' . st('(built-in)') : ''),
    +      '#return_value' => $locale->langcode,
    +      '#default_value' => $locale->langcode == 'en' ? 'en' : '',
    +      '#title' => $name . ($locale->langcode == 'en' ? ' ' . st('(built-in)') : ''),
           '#parents' => array('locale')
         );
       }
    -- 
    cgit v1.2.3