function i18n_url_rewrite in Internationalization 5
Same name and namespace in other branches
- 5.3 i18n.module \i18n_url_rewrite()
- 5.2 i18n.module \i18n_url_rewrite()
Rewrites path with current language and removes prefix if searching for source path
1 call to i18n_url_rewrite()
- i18n.module in ./
i18n.module - Internationalization (i18n) module
File
- ./
i18n.module, line 706 - Internationalization (i18n) module
Code
function i18n_url_rewrite($type, $path, $original) {
if ($type == 'alias' && !i18n_get_lang_prefix($path)) {
return $path ? i18n_get_lang() . '/' . $path : i18n_get_lang();
}
elseif ($type == 'source') {
if ($path == $original) {
return i18n_get_normal_path($path);
}
else {
// Path may have been dealiased but still have language prefix
i18n_get_lang_prefix($path, TRUE);
return $path;
}
}
else {
return $path;
}
}