Thread: [Php-blog-plugin-cvs] additional_plugins/serendipity_event_multilingual ChangeLog, 1.12, 1.13 lang
A reliable, secure & extensible PHP blog | Not mainstream since 2002
Brought to you by:
garvinhicking,
jhermanns
From: Garvin H. <gar...@us...> - 2013-10-01 00:31:48
|
Update of /cvsroot/php-blog/additional_plugins/serendipity_event_multilingual In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10160/serendipity_event_multilingual Modified Files: ChangeLog lang_en.inc.php serendipity_event_multilingual.php Log Message: gitclone.sh autocommit Index: serendipity_event_multilingual.php =================================================================== RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_multilingual/serendipity_event_multilingual.php,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- serendipity_event_multilingual.php 12 Aug 2013 07:58:52 -0000 1.46 +++ serendipity_event_multilingual.php 1 Oct 2013 00:31:46 -0000 1.47 @@ -34,8 +34,8 @@ '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 @@ $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 @@ $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 @@ while(list($key,) = each($properties)) { preg_match('@^multilingual_body_(.+)$@', $key, $match); if (isset($match[1])) { - $langs[] = '<a class="multilingual_' . $match[1] . '" href="' . $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . serendipity_archiveURL($id, $serendipity['languages'][$match[1]], 'serendipityHTTPPath', false) . '&serendipity[lang_selected]=' . $match[1] . '">' . $serendipity['languages'][$match[1]] . '</a>'; + $langs[$match[1]] = '<a class="multilingual_' . $match[1] . '" href="' . $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . serendipity_archiveURL($id, $serendipity['languages'][$match[1]], 'serendipityHTTPPath', false) . '&' . $this->urlparam($match[1]) . '">' . $serendipity['languages'][$match[1]] . '</a>'; } } @@ -203,7 +225,9 @@ } } - $langs[] = '<a class="multilingual_default multilingual_' . $default_lang . '" href="' . $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . serendipity_archiveURL($id, 'Default', 'serendipityHTTPPath', false) . '&serendipity[lang_selected]=default">' . $default_lang . '</a>'; + if (!isset($langs[$default_lang])) { + $langs[$default_lang] = '<a class="multilingual_default multilingual_' . $default_lang . '" href="' . $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?' . serendipity_archiveURL($id, 'Default', 'serendipityHTTPPath', false) . '&' . $this->urlparam('default') . '">' . $default_lang . '</a>'; + } $lang = implode(', ', $langs); return $lang; } Index: ChangeLog =================================================================== RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_multilingual/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ChangeLog 1 Feb 2013 01:32:00 -0000 1.12 +++ ChangeLog 1 Oct 2013 00:31:46 -0000 1.13 @@ -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') Index: lang_en.inc.php =================================================================== RCS file: /cvsroot/php-blog/additional_plugins/serendipity_event_multilingual/lang_en.inc.php,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- lang_en.inc.php 12 Aug 2013 08:29:16 -0000 1.8 +++ lang_en.inc.php 1 Oct 2013 00:31:46 -0000 1.9 @@ -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?'); + ?> |