[Koha-patches] [PATCH] Bug-5621 Google Translation for indian languages.
Amit Gupta
amit.gupta at osslabs.biz
Mon Jan 17 11:36:48 CET 2011
---
C4/Auth.pm | 5 ++-
installer/data/mysql/updatedatabase.pl | 7 +++++
.../prog/en/modules/admin/preferences/opac.pref | 7 +++++
.../opac-tmpl/prog/en/includes/doc-head-close.inc | 4 +-
.../opac-tmpl/prog/en/js/googletransliteration.js | 29 ++++++++++++++++++++
kohaversion.pl | 2 +-
opac/opac-main.pl | 7 +----
opac/opac-search.pl | 7 +----
8 files changed, 51 insertions(+), 17 deletions(-)
create mode 100644 koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js
diff --git a/C4/Auth.pm b/C4/Auth.pm
index 2f13b86..cca0cf2 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -76,7 +76,7 @@ C4::Auth - Authenticates Koha users
query => $query,
type => "opac",
authnotrequired => 1,
- flagsrequired => {borrow => 1, catalogue => '*', tools => 'import_patrons' },
+ flagsrequired => {borrow => 1, catalogue => '*', tools => 'import_patrons'},
}
);
@@ -100,7 +100,7 @@ automatically. This gets loaded into the template.
query => $query,
type => "opac",
authnotrequired => 1,
- flagsrequired => {borrow => 1, catalogue => '*', tools => 'import_patrons' },
+ flagsrequired => {borrow => 1, catalogue => '*', tools => 'import_patrons'},
}
);
@@ -438,6 +438,7 @@ sub get_template_and_user {
reviewson => C4::Context->preference("reviewson"),
suggestion => "" . C4::Context->preference("suggestion"),
virtualshelves => "" . C4::Context->preference("virtualshelves"),
+ GoogleTransliteration => C4::Context->preference("GoogleTransliteration"),
OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
OpacAddMastheadLibraryPulldown => C4::Context->preference("OpacAddMastheadLibraryPulldown"),
OPACXSLTDetailsDisplay => C4::Context->preference("OPACXSLTDetailsDisplay"),
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index cb88827..03e82d8 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3937,6 +3937,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = '3.03.00.013';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GoogleTransliteration','0','Show GoogleTransliteration on the OPAC Masthead.', '','YesNo')");
+ print "Upgrade to $DBversion done (Add GoogleTransliteration on opac page)\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
index acab30a..faef009 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
@@ -1,4 +1,11 @@
OPAC:
+ GoogleTransliteration:
+ -
+ - pref: GoogleTransliteration
+ choices:
+ yes: Show
+ no: "Don't show"
+ - Show GoogleTransliteration on the OPAC Masthead.
Appearance:
-
- Use the
diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc
index beda270..b2a4e91 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/doc-head-close.inc
@@ -79,8 +79,8 @@
//]]>
</script><!-- /TMPL_IF -->
<link rel="unapi-server" type="application/xml" title="unAPI" href="<!-- TMPL_VAR NAME="OPACBaseURL" -->/cgi-bin/koha/unapi" />
-<!-- TMPL_IF NAME="GoogleIndicTransliteration" -->
+<!-- TMPL_IF NAME="GoogleTransliteration" -->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript" language="javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/googleindictransliteration.js"></script>
+ <script type="text/javascript" language="javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/googletransliteration.js"></script>
<!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js b/koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js
new file mode 100644
index 0000000..5672d43
--- /dev/null
+++ b/koha-tmpl/opac-tmpl/prog/en/js/googletransliteration.js
@@ -0,0 +1,29 @@
+ // Load the Google Transliteration API
+ google.load("elements", "1", {
+ packages: "transliteration"
+ });
+
+ function onLoad() {
+ var options = {
+ sourceLanguage: 'en',
+ destinationLanguage: ['hi','kn','ml','ta','te','ar','ur','pa','fa','bn'],
+ shortcutKey: 'ctrl+g',
+ transliterationEnabled: false
+ };
+
+ // Create an instance on TransliterationControl with the required
+ // options.
+ var control =
+ new google.elements.transliteration.TransliterationControl(options);
+
+ // Enable transliteration in the textfields with the given ids.
+ var ids = [ "transl1" ];
+ control.makeTransliteratable(ids);
+
+ // Show the transliteration control which can be used to toggle between
+ // English and Hindi and also choose other destination language.
+ control.showControl('translControl');
+ }
+ google.setOnLoadCallback(onLoad);
+
+
diff --git a/kohaversion.pl b/kohaversion.pl
index fc595a0..270e2d0 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts :
use strict;
sub kohaversion {
- our $VERSION = '3.03.00.012';
+ our $VERSION = '3.03.00.013';
# version needs to be set this way
# so that it can be picked up by Makefile.PL
# during install
diff --git a/opac/opac-main.pl b/opac/opac-main.pl
index e0a65a9..f8b1ff4 100755
--- a/opac/opac-main.pl
+++ b/opac/opac-main.pl
@@ -37,7 +37,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
type => "opac",
query => $input,
authnotrequired => 1,
- flagsrequired => { borrow => 1 },
+ flagsrequired => { borrow => 1},
}
);
@@ -90,9 +90,4 @@ $template->param(
koha_news_count => $koha_news_count
);
-# If GoogleIndicTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens
-if (C4::Context->preference('GoogleIndicTransliteration')) {
- $template->param('GoogleIndicTransliteration' => 1);
-}
-
output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index 45cb766..b5724b5 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -81,7 +81,7 @@ else {
query => $cgi,
type => "opac",
authnotrequired => 1,
- }
+}
);
if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') {
@@ -659,9 +659,4 @@ if (defined $barshelves) {
my $content_type = ($format eq 'rss' or $format eq 'atom') ? $format : 'html';
-# If GoogleIndicTransliteration system preference is On Set paramter to load Google's javascript in OPAC search screens
-if (C4::Context->preference('GoogleIndicTransliteration')) {
- $template->param('GoogleIndicTransliteration' => 1);
-}
-
output_with_http_headers $cgi, $cookie, $template->output, $content_type;
--
1.6.4.2
More information about the Koha-patches
mailing list