Skip to content

Commit f3ed9f9

Browse files
new options: 'monobook_copyright_translate' and 'monobook_sitenotice_translate'
Enables the user to use language specific wiki pages as translated side wide notice / copyright notice if the Translation plugin (cf. http://www.dokuwiki.org/plugin:translation) is available. Works the same way as the multilingual navigation (cf. option 'monobook_navigation_translate').
1 parent b081292 commit f3ed9f9

File tree

6 files changed

+86
-32
lines changed

6 files changed

+86
-32
lines changed

Diff for: conf/default.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@
4141
$conf["monobook_discuss_ns"] = ":talk:"; //namespace to use for discussion page storage
4242

4343
//site notice
44-
$conf["monobook_sitenotice"] = true; //TRUE: use/show sitenotice
45-
$conf["monobook_sitenotice_location"] = ":wiki:site_notice"; //page/article used to store the sitenotice
44+
$conf["monobook_sitenotice"] = true; //TRUE: use/show sitenotice
45+
$conf["monobook_sitenotice_location"] = ":wiki:site_notice"; //page/article used to store the sitenotice
46+
$conf["monobook_sitenotice_translate"] = true; //TRUE: load translated sitenotice if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
4647

4748
//navigation
4849
$conf["monobook_navigation"] = true; //TRUE: use/show navigation
4950
$conf["monobook_navigation_location"] = ":wiki:navigation"; //page/article used to store the navigation
5051
$conf["monobook_navigation_translate"] = true; //TRUE: load translated navigation if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
5152

5253
//custom copyright notice
53-
$conf["monobook_copyright"] = true; //TRUE: use/show copyright notice
54-
$conf["monobook_copyright_default"] = true; //TRUE: use default copyright notice (if copyright notice is enabled at all)
55-
$conf["monobook_copyright_location"] = ":wiki:copyright"; //page/article used to store a custom copyright notice
54+
$conf["monobook_copyright"] = true; //TRUE: use/show copyright notice
55+
$conf["monobook_copyright_default"] = true; //TRUE: use default copyright notice (if copyright notice is enabled at all)
56+
$conf["monobook_copyright_location"] = ":wiki:copyright"; //page/article used to store a custom copyright notice
57+
$conf["monobook_copyright_translate"] = true; //TRUE: load translated copyright notice if translation plugin is available (see <http://www.dokuwiki.org/plugin:translation>)
5658

5759
//search form
5860
$conf["monobook_search"] = true; //TRUE: use/show search form

Diff for: conf/metadata.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@
4141
$meta["monobook_discuss_ns"] = array("string", "_pattern" => "/^:.{1,}:$/");
4242

4343
//site notice
44-
$meta["monobook_sitenotice"] = array("onoff");
45-
$meta["monobook_sitenotice_location"] = array("string");
44+
$meta["monobook_sitenotice"] = array("onoff");
45+
$meta["monobook_sitenotice_location"] = array("string");
46+
$meta["monobook_sitenotice_translate"] = array("onoff");
4647

4748
//navigation
4849
$meta["monobook_navigation"] = array("onoff");
4950
$meta["monobook_navigation_location"] = array("string");
5051
$meta["monobook_navigation_translate"] = array("onoff");
5152

5253
//custom copyright notice
53-
$meta["monobook_copyright"] = array("onoff");
54-
$meta["monobook_copyright_default"] = array("onoff");
55-
$meta["monobook_copyright_location"] = array("string");
54+
$meta["monobook_copyright"] = array("onoff");
55+
$meta["monobook_copyright_default"] = array("onoff");
56+
$meta["monobook_copyright_location"] = array("string");
57+
$meta["monobook_copyright_translate"] = array("onoff");
5658

5759
//search form
5860
$meta["monobook_search"] = array("onoff");

Diff for: lang/de-informal/settings.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@
3838
$lang["monobook_discuss_ns"] = "Falls ja, folgenden ':namensraum:' als Wurzel für Diskussionen nutzen:";
3939

4040
//site notice
41-
$lang["monobook_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
42-
$lang["monobook_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
41+
$lang["monobook_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
42+
$lang["monobook_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
43+
$lang["monobook_sitenotice_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Seiten-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Seiten-Hinweis(e) lautet [Wert von 'monobook_sitenotice_location']_[iso-sprach-code] (z.B. ':wiki:site_notice_en').";
4344

4445
//navigation
4546
$lang["monobook_navigation"] = "Navigation anzeigen?";
4647
$lang["monobook_navigation_location"] = "Falls ja, folgende wiki-Seite als Navigation verwenden:";
4748
$lang["monobook_navigation_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Navigation laden?<br />Die wiki-Seite der übersetzten Navigation(en) lautet [Wert von 'monobook_navigation_location']_[iso-sprach-code] (z.B. ':wiki:navigation_en').";
4849

4950
//custom copyright notice
50-
$lang["monobook_copyright"] = "Copyright-Hinweis einblenden?";
51-
$lang["monobook_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
52-
$lang["monobook_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
51+
$lang["monobook_copyright"] = "Copyright-Hinweis einblenden?";
52+
$lang["monobook_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
53+
$lang["monobook_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
54+
$lang["monobook_copyright_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Copyright-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Copyright-Hinweis(e) lautet [Wert von 'monobook_copyright_location']_[iso-sprach-code] (z.B. ':wiki:copyright_en').";
5355

5456
//search form
5557
$lang["monobook_search"] = "Suchformular anzeigen?";

Diff for: lang/de/settings.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@
3838
$lang["monobook_discuss_ns"] = "Falls ja, folgenden ':namensraum:' als Wurzel für Diskussionen nutzen:";
3939

4040
//site notice
41-
$lang["monobook_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
42-
$lang["monobook_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
41+
$lang["monobook_sitenotice"] = "Seitenübergreifenden Hinweis einblenden?";
42+
$lang["monobook_sitenotice_location"] = "Falls ja, folgende wiki-Seite als Hinweis verwenden:";
43+
$lang["monobook_sitenotice_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Seiten-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Seiten-Hinweis(e) lautet [Wert von 'monobook_sitenotice_location']_[iso-sprach-code] (z.B. ':wiki:site_notice_en').";
4344

4445
//navigation
4546
$lang["monobook_navigation"] = "Navigation anzeigen?";
4647
$lang["monobook_navigation_location"] = "Falls ja, folgende wiki-Seite als Navigation verwenden:";
4748
$lang["monobook_navigation_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Navigation laden?<br />Die wiki-Seite der übersetzten Navigation(en) lautet [Wert von 'monobook_navigation_location']_[iso-sprach-code] (z.B. ':wiki:navigation_en').";
4849

4950
//custom copyright notice
50-
$lang["monobook_copyright"] = "Copyright-Hinweis einblenden?";
51-
$lang["monobook_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
52-
$lang["monobook_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
51+
$lang["monobook_copyright"] = "Copyright-Hinweis einblenden?";
52+
$lang["monobook_copyright_default"] = "Falls ja, Standard-Copyright-Hinweis nutzen?";
53+
$lang["monobook_copyright_location"] = "Falls nicht den Standard-Copyright-Hinweis, folgende wiki-Seite als Copyright-Hinweis verwenden:";
54+
$lang["monobook_copyright_translate"] = "Falls ja und <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation-Plugin</a> verfügbar: sprachspezifische Copyright-Hinweis(e) laden?<br />Die wiki-Seite des/der übersetzten Copyright-Hinweis(e) lautet [Wert von 'monobook_copyright_location']_[iso-sprach-code] (z.B. ':wiki:copyright_en').";
5355

5456
//search form
5557
$lang["monobook_search"] = "Suchformular anzeigen?";

Diff for: lang/en/settings.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@
3838
$lang["monobook_discuss_ns"] = "If yes, use following ':namespace:' as root for discussions:";
3939

4040
//site notice
41-
$lang["monobook_sitenotice"] = "Show site wide notice?";
42-
$lang["monobook_sitenotice_location"] = "If yes, use following wiki page for the site wide notice:";
41+
$lang["monobook_sitenotice"] = "Show site wide notice?";
42+
$lang["monobook_sitenotice_location"] = "If yes, use following wiki page for the site wide notice:";
43+
$lang["monobook_sitenotice_translate"] = "If yes and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific site wide notice?<br />The wiki page of the translated site notice(s) is [value of 'monobook_sitenotice_location']_[iso lang code] (e.g. ':wiki:site_notice_de').";
4344

4445
//navigation
4546
$lang["monobook_navigation"] = "Show navigation?";
4647
$lang["monobook_navigation_location"] = "If yes, use following wiki page as navigation:";
4748
$lang["monobook_navigation_translate"] = "If yes and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific navigation?<br />The wiki page of the translated navigation(s) is [value of 'monobook_navigation_location']_[iso lang code] (e.g. ':wiki:navigation_de').";
4849

4950
//custom copyright notice
50-
$lang["monobook_copyright"] = "Show copyright notice?";
51-
$lang["monobook_copyright_default"] = "If yes, use default copyright notice?";
52-
$lang["monobook_copyright_location"] = "If not default, use following wiki page as copyright notice:";
51+
$lang["monobook_copyright"] = "Show copyright notice?";
52+
$lang["monobook_copyright_default"] = "If yes, use default copyright notice?";
53+
$lang["monobook_copyright_location"] = "If not default, use following wiki page as copyright notice:";
54+
$lang["monobook_copyright_translate"] = "If yes and <a href=\"http://www.dokuwiki.org/plugin:translation\">Translation plugin</a> available: load language specific copyright notice?<br />The wiki page of the translated copyright notice(s) is [value of 'monobook_copyright_location']_[iso lang code] (e.g. ':wiki:copyright_de').";
5355

5456
//search form
5557
$lang["monobook_search"] = "Show search form?";

Diff for: main.php

+51-7
Original file line numberDiff line numberDiff line change
@@ -577,18 +577,40 @@ function _monobook_renderButtons($arr)
577577
html_msgarea();
578578
//show site notice
579579
if (tpl_getConf("monobook_sitenotice")){
580+
//detect wiki page to load as content
581+
if (!empty($transplugin) && //var comes from conf/boxes.php
582+
is_object($transplugin) &&
583+
tpl_getConf("monobook_sitenotice_translate")){
584+
//translated site notice?
585+
$transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
586+
$transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
587+
if (empty($transplugin_langs) ||
588+
empty($transplugin_langcur) ||
589+
!is_array($transplugin_langs) ||
590+
!in_array($transplugin_langcur, $transplugin_langs)) {
591+
//current page is no translation or something is wrong, load default site notice
592+
$sitenotice_location = tpl_getConf("monobook_sitenotice_location");
593+
} else {
594+
//load language specific site notice
595+
$sitenotice_location = tpl_getConf("monobook_sitenotice_location")."_".$transplugin_langcur;
596+
}
597+
}else{
598+
//default site notice, no translation
599+
$sitenotice_location = tpl_getConf("monobook_sitenotice_location");
600+
}
601+
580602
//we have to show a custom sitenotice
581603
if (empty($conf["useacl"]) ||
582-
auth_quickaclcheck(cleanID(tpl_getConf("monobook_sitenotice_location"))) >= AUTH_READ){ //current user got access?
604+
auth_quickaclcheck(cleanID($sitenotice_location)) >= AUTH_READ){ //current user got access?
583605
echo "\n <div id=\"siteNotice\" class=\"noprint\">\n";
584606
//get the rendered content of the defined wiki article to use as
585607
//custom sitenotice.
586-
$interim = tpl_include_page(tpl_getConf("monobook_sitenotice_location"), false);
608+
$interim = tpl_include_page($sitenotice_location, false);
587609
if ($interim === "" ||
588610
$interim === false){
589611
//show creation/edit link if the defined page got no content
590612
echo "[&#160;";
591-
tpl_pagelink(tpl_getConf("monobook_sitenotice_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_sitenotice_location").")"));
613+
tpl_pagelink($sitenotice_location, hsc($lang["monobook_fillplaceholder"]." (".hsc($sitenotice_location).")"));
592614
echo "&#160;]<br />";
593615
}else{
594616
//show the rendered page content
@@ -774,18 +796,40 @@ function _monobook_renderButtons($arr)
774796
echo "<li id=\"copyright\">\n <div class=\"dokuwiki\">";
775797
tpl_license(false);
776798
echo "</div>\n </li>\n";
777-
//show custom notice.
799+
//show custom notice
778800
}else{
801+
//detect wiki page to load as content
802+
if (!empty($transplugin) && //var comes from conf/boxes.php
803+
is_object($transplugin) &&
804+
tpl_getConf("monobook_copyright_translate")){
805+
//translated copyright notice?
806+
$transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
807+
$transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
808+
if (empty($transplugin_langs) ||
809+
empty($transplugin_langcur) ||
810+
!is_array($transplugin_langs) ||
811+
!in_array($transplugin_langcur, $transplugin_langs)) {
812+
//current page is no translation or something is wrong, load default copyright notice
813+
$copyright_location = tpl_getConf("monobook_copyright_location");
814+
} else {
815+
//load language specific copyright notice
816+
$copyright_location = tpl_getConf("monobook_copyright_location")."_".$transplugin_langcur;
817+
}
818+
}else{
819+
//default copyright notice, no translation
820+
$copyright_location = tpl_getConf("monobook_copyright_location");
821+
}
822+
779823
if (empty($conf["useacl"]) ||
780-
auth_quickaclcheck(cleanID(tpl_getConf("monobook_copyright_location"))) >= AUTH_READ){ //current user got access?
824+
auth_quickaclcheck(cleanID($copyright_location)) >= AUTH_READ){ //current user got access?
781825
echo "<li id=\"copyright\">\n ";
782826
//get the rendered content of the defined wiki article to use as custom notice
783-
$interim = tpl_include_page(tpl_getConf("monobook_copyright_location"), false);
827+
$interim = tpl_include_page($copyright_location, false);
784828
if ($interim === "" ||
785829
$interim === false){
786830
//show creation/edit link if the defined page got no content
787831
echo "[&#160;";
788-
tpl_pagelink(tpl_getConf("monobook_copyright_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_copyright_location").")"));
832+
tpl_pagelink($copyright_location, hsc($lang["monobook_fillplaceholder"]." (".hsc($copyright_location).")"));
789833
echo "&#160;]<br />";
790834
}else{
791835
//show the rendered page content

0 commit comments

Comments
 (0)