From: Frédéric Demians Date: Wed, 1 Apr 2009 19:36:28 +0000 (+0200) Subject: Internationalize Amazon support X-Git-Tag: ontop~294 X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=02b5091c1a0dd8e5b26ebf675cbb61744007f664;p=koha.git 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 --- diff --git a/C4/External/Amazon.pm b/C4/External/Amazon.pm index 7d0c1b546a..a0c922fc8e 100644 --- a/C4/External/Amazon.pm +++ b/C4/External/Amazon.pm @@ -35,9 +35,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::External::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 ab24ae168a..97da43257b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -52,7 +52,7 @@
- /ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank">.01._PIdp-schmooS,TopRight,7,-26_SCMZZZZZZZ_.jpg" alt="Cover Image" />/ref=sib_dp_pt/002-7879865-0184864#reader-link">.01._PIdp-schmooS,TopRight,7,-26_SCMZZZZZZZ_.jpg" alt="Cover Image" /> + /gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link" target="_blank">.01.MZZZZZZZ.jpg" alt="Cover Image" />/gp/reader//ref=sib_dp_pt/002-7879865-0184864#reader-link">.01.MZZZZZZZ.jpg" alt="Cover Image" /> /.GIF&client=&type=xw10&upc=&oclc=" alt="" class="thumbnail" />No cover image available
" class="" id="gbs-thumbnail">
" target="_blank">See Baker & Taylor" />">See Baker & Taylor" /> diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index f354b92b23..3dc274297a 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -260,6 +260,9 @@ if (C4::Context->preference("OPACFRBRizeEditions")==1) { if ($@) { warn "XISBN Failed $@"; } } # Amazon.com Stuff +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( $isbn, $record, $marcflavour );