function i18n_url_rewrite in Internationalization 5.3
Same name and namespace in other branches
- 5 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 752 - Internationalization (i18n) module
Code
function i18n_url_rewrite($type, $path, $original) {
if ($type == 'alias' && !strpos($path, '://') && !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;
}
}