--- drupal-6.10/sites/flickbites.com/modules/amazon/amazon.module.orig	2009-03-09 20:51:05.000000000 +0100
+++ drupal-6.10/sites/flickbites.com/modules/amazon/amazon.module	2009-03-09 22:27:47.000000000 +0100
@@ -218,7 +218,16 @@
   }
 }
 
-function amazon_item_lookup($item_ids = array(), $force_lookup = FALSE) {
+/**
+ * Use locale TRUE to force lookup using the default locale
+ *            FALSE to use the cache and the default locale
+ *            'US', 'FR', ... to force the use of that locale (without cache)
+ */
+function amazon_item_lookup($item_ids = array(), $locale = FALSE) {
+  // We cannot use the cache is the $locale is set, since the cache
+  // is only valid for the default locale
+  $force_lookup = $locale != FALSE;
+
   if (empty($item_ids)) {
     return array();
   }
@@ -236,11 +245,14 @@
       $items_to_fetch[] = $item_id;
     }
   }
-  $items_from_web = amazon_item_lookup_from_web($items_to_fetch);
+  if (!$locale) {
+     $locale = NULL;
+  }
+  $items_from_web = amazon_item_lookup_from_web($items_to_fetch, $locale);
   return array_merge($items, $items_from_web);
 }
 
-function amazon_item_lookup_from_web($item_ids = array()) {
+function amazon_item_lookup_from_web($item_ids = array(), $locale) {
   // We do this to avoid bombing Amazon.com with 1000 item requests.
   $amazon_limit = 10;
   $asins = array();
@@ -248,27 +260,30 @@
   foreach ($item_ids as $asin) {
     $asins[] = $asin;
     if (count($asins) >= $amazon_limit || count($asins) == count($item_ids)) {
-      $results += _amazon_item_batch_lookup_from_web($asins);
+      $results += _amazon_item_batch_lookup_from_web($asins, $locale);
       $asins = array();
     }
   }
   return $results;
 }
 
-function _amazon_item_batch_lookup_from_web($item_ids = array()) {
+function _amazon_item_batch_lookup_from_web($item_ids = array(), $locale) {
   if (!empty($item_ids)) {
     $params = array(
       'ItemId' => implode(',', $item_ids),
       'ResponseGroup' => 'Large',
     );
-    $results = amazon_http_request('ItemLookup', $params);
+    $results = amazon_http_request('ItemLookup', $params, $locale);
     if (!empty($results->Error)) {
       return FALSE;
     }
     $items = array();
     foreach($results->Items->Item as $xml) {
       $item = amazon_item_clean_xml($xml);
-      amazon_item_save($item);
+      // We only cache the result if we are using the default locale
+      if ($locale == NULL) {
+        amazon_item_save($item);
+      }
       $items[$item['asin']] = $item;
     }
 
