diff --git a/serendipity_event_multilingual/ChangeLog b/serendipity_event_multilingual/ChangeLog
index c0858be2..611b28e8 100644
--- a/serendipity_event_multilingual/ChangeLog
+++ b/serendipity_event_multilingual/ChangeLog
@@ -1,3 +1,5 @@
+2.15: Added new "langswitch" variable to allow users forcing to switch the frontend language based on the content language
+
2.14: Added genpage event hook so that blogTitle/Description gets replaced in other instances
where entries are not fetched (i.e. 'archives')
diff --git a/serendipity_event_multilingual/lang_en.inc.php b/serendipity_event_multilingual/lang_en.inc.php
index ab327184..9dc9065a 100644
--- a/serendipity_event_multilingual/lang_en.inc.php
+++ b/serendipity_event_multilingual/lang_en.inc.php
@@ -36,4 +36,7 @@
@define('PLUGIN_SIDEBAR_MULTILINGUAL_SUBMIT_DESC', 'Show a submit button?');
@define('PLUGIN_SIDEBAR_MULTILINGUAL_SIZE', 'Font size');
+@define('PLUGIN_SIDEBAR_MULTILINGUAL_LANGSWITCH', 'Force full language switch?');
+@define('PLUGIN_SIDEBAR_MULTILINGUAL_LANGSWITCH_DESC', 'Choosing a translation for a blog entry will also switch the whole language of the blog?');
+
?>
diff --git a/serendipity_event_multilingual/serendipity_event_multilingual.php b/serendipity_event_multilingual/serendipity_event_multilingual.php
index bfe7fd57..4c05f7eb 100755
--- a/serendipity_event_multilingual/serendipity_event_multilingual.php
+++ b/serendipity_event_multilingual/serendipity_event_multilingual.php
@@ -34,8 +34,8 @@ class serendipity_event_multilingual extends serendipity_event
'php' => '4.1.0'
));
$propbag->add('groups', array('FRONTEND_ENTRY_RELATED', 'BACKEND_EDITOR'));
- $propbag->add('version', '2.14');
- $propbag->add('configuration', array('copytext', 'placement', 'tagged_title', 'tagged_entries', 'tagged_sidebar'));
+ $propbag->add('version', '2.15');
+ $propbag->add('configuration', array('copytext', 'placement', 'tagged_title', 'tagged_entries', 'tagged_sidebar', 'langswitch'));
$propbag->add('event_hooks', array(
'frontend_fetchentries' => true,
'frontend_fetchentry' => true,
@@ -131,6 +131,13 @@ class serendipity_event_multilingual extends serendipity_event
$propbag->add('default', 'false');
break;
+ case 'langswitch':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', PLUGIN_EVENT_MULTILINGUAL_LANGSWITCH);
+ $propbag->add('description', PLUGIN_EVENT_MULTILINGUAL_LANGSWITCH_DESC);
+ $propbag->add('default', 'true');
+ break;
+
case 'tagged_sidebar':
$propbag->add('type', 'boolean');
$propbag->add('name', PLUGIN_EVENT_MULTILINGUAL_TAGSIDEBAR);
@@ -166,6 +173,21 @@ class serendipity_event_multilingual extends serendipity_event
$title = $this->title;
}
+ function urlparam($key) {
+ static $langswitch = null;
+
+ if ($langswitch === null) {
+ $langswitch = serendipity_db_bool($this->get_config('langswitch'));
+ }
+
+ if ($langswitch) {
+ // user_language
+ return 'serendipity[lang_selected]=' . $key . '&serendipity[user_language]=' . $key;
+ } else {
+ return 'serendipity[lang_selected]=' . $key;
+ }
+ }
+
function &getLang($id, &$properties) {
global $serendipity;
static $default_lang = null;
@@ -181,7 +203,7 @@ class serendipity_event_multilingual extends serendipity_event
while(list($key,) = each($properties)) {
preg_match('@^multilingual_body_(.+)$@', $key, $match);
if (isset($match[1])) {
- $langs[] = '' . $serendipity['languages'][$match[1]] . '';
+ $langs[$match[1]] = '' . $serendipity['languages'][$match[1]] . '';
}
}
@@ -203,7 +225,9 @@ class serendipity_event_multilingual extends serendipity_event
}
}
- $langs[] = '' . $default_lang . '';
+ if (!isset($langs[$default_lang])) {
+ $langs[$default_lang] = '' . $default_lang . '';
+ }
$lang = implode(', ', $langs);
return $lang;
}