diff --git a/classes/locale-negotiator.php b/classes/locale-negotiator.php index 613d16b..77935cb 100644 --- a/classes/locale-negotiator.php +++ b/classes/locale-negotiator.php @@ -14,12 +14,13 @@ class LocaleNegotiator */ function __construct($default_language) { - $tmp = glob(__DIR__ . '/locale/*' , GLOB_ONLYDIR); + $tmp = glob(__DIR__ . '/../locale/*' , GLOB_ONLYDIR); $this->default_language = $default_language; //Works only if the server supports the locale //This basically means $accepted_langs[] = ""; - foreach ($accepted_langs as $key => $value) { - $this->accepted_langs[basename($value)] = self::mb_ucfirst(locale_get_display_language($lang, $lang)); + foreach ($tmp as $key => $value) { + $lang = basename($value); + $this->accepted_langs[$lang] = self::mb_ucfirst(locale_get_display_language($lang, $lang)); } } diff --git a/config.php.template b/config.php.template index 5149d86..c42fc9a 100644 --- a/config.php.template +++ b/config.php.template @@ -11,10 +11,11 @@ define("DEFAULT_LANGUAGE", "en_GB"); require("classes/locale-negotiator.php"); +$negotiator = new LocaleNegotiator(DEFAULT_LANGUAGE); + if (!isset($_SESSION['locale'])||isset($_GET['lang'])) { $override = ((isset($_GET['lang']))?$_GET['lang']:null); - $negotiator = new LocaleNegotiator(DEFAULT_LANGUAGE); $best_match = $negotiator->negotiate($override); $_SESSION['locale'] = $best_match; setlocale(LC_ALL, $_SESSION['locale'].".UTF-8"); diff --git a/template.php b/template.php index 5b0408d..e419921 100644 --- a/template.php +++ b/template.php @@ -1,5 +1,13 @@
- -
-
-
-
-
Copyright © Vojtěch Sajdl
-
-
- - - -
+ /** + * Renders footer + * @param Boolean $admin decides whether to load admin scripts + */ + public static function render_footer($admin = false) + { + global $negotiator; + $lang_names = $negotiator->get_accepted_langs(); + ?> +
+
+
+
+
Copyright © Vojtěch Sajdl
+
+
+ + +
-
-
-
-
- - - - - - - - - - - - +
+
+
+
+ + + + + + + + + + + +