From 24c155aab93e4ad200bd37113218d19057bd0313 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Demians?= Date: Wed, 1 Apr 2009 21:36:28 +0200 Subject: [PATCH] Internationalize Amazon support With this patch: * On Amazon book cover, 'search inside' text is not displayed anymore because it's not translatable. * Link the image to local Amazon web site 'search inside' service. Based on AmazonLocale syspref. Signed-off-by: Galen Charlton Signed-off-by: Henri-Damien LAURENT --- C4/Amazon.pm | 30 ++++++++++++------- .../prog/en/modules/opac-detail.tmpl | 7 ++--- opac/opac-detail.pl | 5 +++- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/C4/Amazon.pm b/C4/Amazon.pm index a9cb3392ec..21ece8941e 100644 --- a/C4/Amazon.pm +++ b/C4/Amazon.pm @@ -34,9 +34,27 @@ BEGIN { @EXPORT = qw( &get_amazon_details &check_search_inside + &get_amazon_tld ); } + +sub get_amazon_tld { + my %tld = ( + CA => '.ca', + DE => '.de', + FR => '.fr', + JP => '.jp', + UK => '.co.uk', + US => '.com', + ); + + my $locale = C4::Context->preference('AmazonLocale'); + my $tld = $tld{ $locale } || '.com'; # default top level domain is .com + return $tld; +} + + =head1 NAME C4::Amazon - Functions for retrieving Amazon.com content in Koha @@ -100,17 +118,7 @@ sub get_amazon_details { # Determine which content to grab in the request # Determine correct locale - my $locale_hashref = { - CA => '.ca', - DE => '.de', - FR => '.fr', - JP => '.jp', - UK => '.co.uk', - US => '.com', - }; - - my $amazon_locale_syspref = C4::Context->preference('AmazonLocale'); - my $tld = $locale_hashref->{$amazon_locale_syspref} || '.com'; # default top level domain is .com + my $tld = get_amazon_tld(); # grab the AWSAccessKeyId: mine is '0V5RRRRJZ3HR2RQFNHR2' my $aws_access_key_id = C4::Context->preference('AWSAccessKeyID'); diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index 6e2304baf4..892008223f 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -54,10 +54,9 @@
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 708a1607cb..43e8531160 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -258,7 +258,10 @@ if (C4::Context->preference("OPACFRBRizeEditions")==1) { if ($@) { warn "XISBN Failed $@"; } } # Amazon.com Stuff -if ( C4::Context->preference("OPACAmazonContent") == 1 ) { +if ( C4::Context->preference("OPACAmazonEnabled") ) { + $template->param( AmazonTld => get_amazon_tld() ); +} +if ( C4::Context->preference("OPACAmazonEnabled") && C4::Context->preference("OPACAmazonSimilarItems") ) { my $similar_products_exist; my $amazon_details = &get_amazon_details( $xisbn, $record, $marcflavour ); my $item_attributes = \%{$amazon_details->{Items}->{Item}->{ItemAttributes}}; -- 2.39.5