Mercurial > defr > drupal > core
comparison modules/locale/locale.module @ 13:8b6c45761e01 6.6
Drupal 6.6
| author | Franck Deroche <webmaster@defr.org> |
|---|---|
| date | Tue, 23 Dec 2008 14:32:33 +0100 |
| parents | 589fb7c02327 |
| children |
comparison
equal
deleted
inserted
replaced
| 12:4ca9f57cc4d4 | 13:8b6c45761e01 |
|---|---|
| 1 <?php | 1 <?php |
| 2 // $Id: locale.module,v 1.212.2.4 2008/09/08 21:51:50 dries Exp $ | 2 // $Id: locale.module,v 1.212.2.5 2008/10/20 09:31:06 goba Exp $ |
| 3 | 3 |
| 4 /** | 4 /** |
| 5 * @file | 5 * @file |
| 6 * Add language handling functionality and enables the translation of the | 6 * Add language handling functionality and enables the translation of the |
| 7 * user interface to languages other than English. | 7 * user interface to languages other than English. |
| 571 } | 571 } |
| 572 | 572 |
| 573 // Only show if we have at least two languages and language dependent | 573 // Only show if we have at least two languages and language dependent |
| 574 // web addresses, so we can actually link to other language versions. | 574 // web addresses, so we can actually link to other language versions. |
| 575 elseif ($op == 'view' && variable_get('language_count', 1) > 1 && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) != LANGUAGE_NEGOTIATION_NONE) { | 575 elseif ($op == 'view' && variable_get('language_count', 1) > 1 && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) != LANGUAGE_NEGOTIATION_NONE) { |
| 576 $path = drupal_is_front_page() ? '<front>' : $_GET['q']; | |
| 576 $languages = language_list('enabled'); | 577 $languages = language_list('enabled'); |
| 577 $links = array(); | 578 $links = array(); |
| 578 foreach ($languages[1] as $language) { | 579 foreach ($languages[1] as $language) { |
| 579 $links[$language->language] = array( | 580 $links[$language->language] = array( |
| 580 'href' => $_GET['q'], | 581 'href' => $path, |
| 581 'title' => $language->native, | 582 'title' => $language->native, |
| 582 'language' => $language, | 583 'language' => $language, |
| 583 'attributes' => array('class' => 'language-link'), | 584 'attributes' => array('class' => 'language-link'), |
| 584 ); | 585 ); |
| 585 } | 586 } |
| 586 | 587 |
| 587 // Allow modules to provide translations for specific links. | 588 // Allow modules to provide translations for specific links. |
| 588 // A translation link may need to point to a different path or use | 589 // A translation link may need to point to a different path or use |
| 589 // a translated link text before going through l(), which will just | 590 // a translated link text before going through l(), which will just |
| 590 // handle the path aliases. | 591 // handle the path aliases. |
| 591 drupal_alter('translation_link', $links, $_GET['q']); | 592 drupal_alter('translation_link', $links, $path); |
| 592 | 593 |
| 593 $block['subject'] = t('Languages'); | 594 $block['subject'] = t('Languages'); |
| 594 $block['content'] = theme('links', $links, array()); | 595 $block['content'] = theme('links', $links, array()); |
| 595 return $block; | 596 return $block; |
| 596 } | 597 } |
