diff options
Diffstat (limited to 'langs.inc.php')
-rw-r--r-- | langs.inc.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/langs.inc.php b/langs.inc.php index b38c58ef2..29b66f070 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -21,4 +21,28 @@ $langs = array( 'sl' => 'Slovenščina', 'zh-cn' => '简体中文', 'zh-tw' => '正體中文' -);
\ No newline at end of file +); + +/** + * Redirect to a localized path. + * + * @param array $langs list of languages + * @param string $page optional path to which we want to redirect + * @param string $default_locale + * + * @return void +*/ +function relocate($langs, $page = '', $default_locale = 'en') +{ + require_once 'localeDetection.class.php'; + + $locale = new ChooseLocale(array_keys($langs)); + + $locale->setDefaultLocale($default_locale); + + header(sprintf('Location: /%s/%s', + $locale->getCompatibleLocale(), + $page + )); + die; +}
\ No newline at end of file |