diff --git a/boot.php b/boot.php index abbacdf4e7..8a2706252a 100644 --- a/boot.php +++ b/boot.php @@ -2669,3 +2669,23 @@ function extract_item_authors($arr,$uid) { } return array(); }} + +if(! function_exists('lang_selector')) { +function lang_selector() { + global $lang; + $o .= ''; + return $o; +}} diff --git a/include/main.js b/include/main.js index 750cce74c0..18e884b317 100644 --- a/include/main.js +++ b/include/main.js @@ -26,6 +26,7 @@ var pr = 0; var liking = 0; var in_progress = false; + var langSelect = false; $(document).ready(function() { $.ajaxSetup({cache: false}); @@ -45,6 +46,18 @@ $('#pause').html(''); } } + // F8 - show/hide language selector + if(event.keyCode == '119') { + if(langSelect) { + langSelect = false; + $('#language-selector').hide(); + } + else { + langSelect = true; + $('#language-selector').show(); + } + } + // this is shift-home on FF, but $ on IE, disabling until I figure out why the diff. // update: incompatible usage of onKeyDown vs onKeyPress // if(event.keyCode == '36' && event.shiftKey == true) { diff --git a/include/nav.php b/include/nav.php index db3b909af1..b8b65f84d0 100644 --- a/include/nav.php +++ b/include/nav.php @@ -16,6 +16,7 @@ function nav(&$a) { */ $a->page['nav'] .= '' ; + $a->page['nav'] .= lang_selector(); /** * diff --git a/index.php b/index.php index ab722df2aa..9412c1e3bd 100644 --- a/index.php +++ b/index.php @@ -42,6 +42,11 @@ if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { } else { $lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); } +if(x($_POST,'system_language')) +if(x($_SESSION,'language')) + $lang = $_SESSION['language']; + + load_translation_table($lang); @@ -86,6 +91,19 @@ $a->init_pagehead(); session_start(); +/** + * Language was set earlier, but we can over-ride it in the session. + * We have to do it here because the session was just now opened. + */ + +if(x($_POST,'system_language')) + $_SESSION['language'] = $_POST['system_language']; +if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) { + $lang = $_SESSION['language']; + load_translation_table($lang); +} + + /** * * For Mozilla auth manager - still needs sorting, and this might conflict with LRDD header. diff --git a/view/theme/duepuntozero/style.css b/view/theme/duepuntozero/style.css index 042cc380ff..0d59b65900 100644 --- a/view/theme/duepuntozero/style.css +++ b/view/theme/duepuntozero/style.css @@ -2183,3 +2183,9 @@ a.mail-list-link { .side-link { margin-bottom: 15px; } + +#language-selector { + position: absolute; + top: 0; + left: 0; +) diff --git a/view/theme/loozah/style.css b/view/theme/loozah/style.css index a618381575..5662207115 100644 --- a/view/theme/loozah/style.css +++ b/view/theme/loozah/style.css @@ -2205,3 +2205,9 @@ a.mail-list-link { .side-link { margin-bottom: 15px; } + +#language-selector { + position: absolute; + top: 0; + left: 0; +)