123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php
- function hook_language_init() {
- global $language, $conf;
- switch ($language->language) {
- case 'it':
- $conf['site_name'] = 'Il mio sito Drupal';
- break;
- case 'fr':
- $conf['site_name'] = 'Mon site Drupal';
- break;
- }
- }
- function hook_language_switch_links_alter(array &$links, $type, $path) {
- global $language;
- if ($type == LANGUAGE_TYPE_CONTENT && isset($links[$language->language])) {
- foreach ($links[$language->language] as $link) {
- $link['attributes']['class'][] = 'active-language';
- }
- }
- }
- function hook_language_types_info() {
- return array(
- 'custom_language_type' => array(
- 'name' => t('Custom language'),
- 'description' => t('A custom language type.'),
- ),
- 'fixed_custom_language_type' => array(
- 'fixed' => array('custom_language_provider'),
- ),
- );
- }
- function hook_language_types_info_alter(array &$language_types) {
- if (isset($language_types['custom_language_type'])) {
- $language_types['custom_language_type_custom']['description'] = t('A far better description.');
- }
- }
- function hook_language_negotiation_info() {
- return array(
- 'custom_language_provider' => array(
- 'callbacks' => array(
- 'language' => 'custom_language_provider_callback',
- 'switcher' => 'custom_language_switcher_callback',
- 'url_rewrite' => 'custom_language_url_rewrite_callback',
- ),
- 'file' => drupal_get_path('module', 'custom') . '/custom.module',
- 'weight' => -4,
- 'types' => array('custom_language_type'),
- 'name' => t('Custom language negotiation provider'),
- 'description' => t('This is a custom language negotiation provider.'),
- 'cache' => 0,
- ),
- );
- }
- function hook_language_negotiation_info_alter(array &$language_providers) {
- if (isset($language_providers['custom_language_provider'])) {
- $language_providers['custom_language_provider']['config'] = 'admin/config/regional/language/configure/custom-language-provider';
- }
- }
- function hook_language_fallback_candidates_alter(array &$fallback_candidates) {
- $fallback_candidates = array_reverse($fallback_candidates);
- }
|