You are here

function i18n_get_normal_path in Internationalization 5.3

Same name and namespace in other branches
  1. 5 i18n.module \i18n_get_normal_path()
  2. 5.2 i18n.module \i18n_get_normal_path()

This function is similar to drupal_get_normal_path, but language-aware Also removes language from path

3 calls to i18n_get_normal_path()
i18n_frontpage in ./i18n.module
Language dependent front page This function will search for aliases like 'en/home', 'es/home'...
i18n_init in ./i18n.module
Implementation of hook_init()
i18n_url_rewrite in ./i18n.module
Rewrites path with current language and removes prefix if searching for source path

File

./i18n.module, line 521
Internationalization (i18n) module

Code

function i18n_get_normal_path($path) {
  $prefix = i18n_get_lang_prefix($path, TRUE);
  if (!$prefix || _i18n_is_bootstrap()) {

    // If bootstrap, drupal_lookup_path is not defined
    return $path;
  }
  elseif ($alias = drupal_lookup_path('source', $prefix . '/' . $path)) {
    i18n_get_lang_prefix($alias, TRUE);

    // In case alias has language
    return $alias;
  }
  elseif ($alias = drupal_lookup_path('source', $path)) {
    i18n_get_lang_prefix($alias, TRUE);
    return $alias;
  }
  else {
    return $path;
  }
}