language_url_rewrite(&$path, &$options)
drupal-6/includes/language.inc, line 104
Rewrite URL's with language based prefix. Parameters are the same as those of the url() function.
<?php
function language_url_rewrite(&$path, &$options) {
global $language;
// Only modify relative (insite) URLs.
if (!$options['external']) {
// Language can be passed as an option, or we go for current language.
if (!isset($options['language'])) {
$options['language'] = $language;
}
switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
case LANGUAGE_NEGOTIATION_NONE:
// No language dependent path allowed in this mode.
unset($options['language']);
break;
case LANGUAGE_NEGOTIATION_DOMAIN:
if ($options['language']->domain) {
// Ask for an absolute URL with our modified base_url.
$options['absolute'] = TRUE;
$options['base_url'] = $options['language']->domain;
}
break;
case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
$default = language_default();
if ($options['language']->language == $default->language) {
break;
}
// Intentionally no break here.
case LANGUAGE_NEGOTIATION_PATH:
if (!empty($options['language']->prefix)) {
$options['prefix'] = $options['language']->prefix .'/';
}
break;
}
}
}
?>