diff options
author | Damien Lallement <dams@mageia.org> | 2011-02-15 17:59:55 +0000 |
---|---|---|
committer | Damien Lallement <dams@mageia.org> | 2011-02-15 17:59:55 +0000 |
commit | c598c63d01083fcd1a6fdcbf624d7c059c8c0cb2 (patch) | |
tree | b1a40b4f2efd780909634a0da966ad2eda7e9806 | |
parent | a283a87ff9c8ce205ad0d7ced2f5ca4b62885381 (diff) | |
download | www-c598c63d01083fcd1a6fdcbf624d7c059c8c0cb2.tar www-c598c63d01083fcd1a6fdcbf624d7c059c8c0cb2.tar.gz www-c598c63d01083fcd1a6fdcbf624d7c059c8c0cb2.tar.bz2 www-c598c63d01083fcd1a6fdcbf624d7c059c8c0cb2.tar.xz www-c598c63d01083fcd1a6fdcbf624d7c059c8c0cb2.zip |
new function to prevent 404 error with missing translations
-rw-r--r-- | langs.php | 15 | ||||
-rw-r--r-- | lib/news.php | 2 |
2 files changed, 16 insertions, 1 deletions
@@ -47,6 +47,21 @@ foreach ($langs as $k => $v) $v); } +// prevent 404 error on /{$locale}/ with missing translation +function locale_path($locale,$path) +{ + $filename = "/".$locale."/".$path."/"; + if (file_exists($filename) + { + $url = $filename; + } + else + { + $url = "/en/".$path; + } + return $url; +} + // global nav $nav_list = array( "/{$locale}/" => 'Mageia', diff --git a/lib/news.php b/lib/news.php index 0a7bcc3c5..f3160aee0 100644 --- a/lib/news.php +++ b/lib/news.php @@ -103,4 +103,4 @@ function get_news($locale = 'en', $count = 5, $cache_timeout = 5) unset($feed); return $items; -}
\ No newline at end of file +} |