summaryrefslogtreecommitdiff
path: root/modules/user/helpers/user_theme.php
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-09-04 11:06:20 -0700
committerAndy Staudacher <andy.st@gmail.com>2009-09-04 11:06:20 -0700
commit001623c755777846a468255d4396d30b253dcdfb (patch)
tree2bf78736cb8da45b3fe584ef0a67cb4898d47a3f /modules/user/helpers/user_theme.php
parentc453c0ef8239bc79e484dd3feb9e275e942e9d48 (diff)
Add new locale preferences: Adding per session (cookie) locale preferences and check the browser's / OS' locale preferences.
Ticket 582.
Diffstat (limited to 'modules/user/helpers/user_theme.php')
-rw-r--r--modules/user/helpers/user_theme.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php
index 8de2d248..5b973ef3 100644
--- a/modules/user/helpers/user_theme.php
+++ b/modules/user/helpers/user_theme.php
@@ -18,6 +18,14 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class user_theme_Core {
+ static function head($theme) {
+ if (count(locales::installed())) {
+ // Needed by the languages block
+ $theme->script("jquery.cookie.js");
+ }
+ return "";
+ }
+
static function header_top($theme) {
if ($theme->page_type != "login") {
$view = new View("login.html");
@@ -25,4 +33,20 @@ class user_theme_Core {
return $view->render();
}
}
+
+ static function sidebar_blocks($theme) {
+ $locales = locales::installed();
+ foreach ($locales as $locale => $display_name) {
+ $locales[$locale] = SafeString::of_safe_html($display_name);
+ }
+ if (count($locales) > 1) {
+ $block = new Block();
+ $block->css_id = "gUserLanguageBlock";
+ $block->title = t("Select Language Preference");
+ $block->content = new View("user_languages_block.html");
+ $block->content->installed_locales = array_merge(array("" => t("« none »")), $locales);
+ $block->content->selected = (string) user::cookie_locale();
+ return $block;
+ }
+ }
}