From 2810b9fd38ce7b75e593ed14d4d17bd66a8e26bc Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Wed, 4 Apr 2018 13:30:04 -0300
Subject: [PATCH] Bug 19817: Add pref KohaManualLanguage
---
Koha/Manual.pm | 4 ++--
installer/data/mysql/atomicupdate/bug_19817.sql | 3 +++
installer/data/mysql/sysprefs.sql | 1 +
.../prog/en/modules/admin/preferences/enhanced_content.pref | 13 +++++++++++++
4 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/Koha/Manual.pm b/Koha/Manual.pm
index 68eb2e148f..fe0c3a2998 100644
--- a/Koha/Manual.pm
+++ b/Koha/Manual.pm
@@ -17,12 +17,12 @@ sub _get_help_version {
}
sub _get_base_url {
- # FIXME /en/ must be configurable (or guessed)
my $KohaManualBaseURL = C4::Context->preference('KohaManualBaseURL') || 'http://koha-community.org/manual';
+ my $KohaManualLanguage = C4::Context->preference('KohaManualLanguage') || 'en';
if ( $KohaManualBaseURL =~ m|^/| ) {
$KohaManualBaseURL = C4::Context->preference('staffClientBaseURL') . $KohaManualBaseURL;
}
- return $KohaManualBaseURL . '/' . _get_help_version . '/en/html';
+ return $KohaManualBaseURL . '/' . _get_help_version . '/' . $KohaManualLanguage . '/html'; # TODO html could be a KohaManualFormat with pdf, html, epub
}
our $mapping = {
diff --git a/installer/data/mysql/atomicupdate/bug_19817.sql b/installer/data/mysql/atomicupdate/bug_19817.sql
index b2409ebbd6..56ef20ab34 100644
--- a/installer/data/mysql/atomicupdate/bug_19817.sql
+++ b/installer/data/mysql/atomicupdate/bug_19817.sql
@@ -1,2 +1,5 @@
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
VALUES ('KohaManualBaseURL','http://koha-community.org/manual/','','Where is the Koha manual/documentation located?','Free');
+
+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` )
+VALUES ('KohaManualLanguage','en','en|ar|cs|es|fr|it|pt_BR|tr|zh_TW','What is the language of the online manual you want to use?','Choice');
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 2b06a39da6..e4513c5ada 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -241,6 +241,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('itemcallnumber','082ab',NULL,'The MARC field/subfield that is used to calculate the itemcallnumber (Dewey would be 082ab or 092ab; LOC would be 050ab or 090ab) could be 852hi from an item record','free'),
('KohaAdminEmailAddress','root@localhost','','Define the email address where patron modification requests are sent','free'),
('KohaManualBaseURL','http://koha-community.org/manual/','','Where is the Koha manual/documentation located?','Free'),
+('KohaManualLanguage','en','en|ar|cs|es|fr|it|pt_BR|tr|zh_TW','What is the language of the online manual you want to use?','Choice'),
('LabelMARCView','standard','standard|economical','Define how a MARC record will display','Choice'),
('language','en',NULL,'Set the default language in the staff client.','Languages'),
('LetterLog','1',NULL,'If ON, log all notices sent','YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
index 286589151b..bb6350cdb7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref
@@ -404,3 +404,16 @@ Enhanced Content:
- You can specify the location of the Koha manual to use. By default it is http://koha-community.org/manual/
- If starts with '/', the value of staffClientBaseURL will be used as a prefix.
- Note that it will be suffixed by the version / the language / the format (/17.11/en/html)
+ -
+ - Language of the online manual
+ - pref: KohaManualLanguage
+ choices:
+ en: English
+ ar: Arabic
+ cs: Czech
+ es: Spanish
+ fr: French
+ it: Italian
+ pt_BR: Portuguese – Brazil
+ tr: Turkish
+ zh_TW: Chinese – Taiwan
--
2.11.0