### Eclipse Workspace Patch 1.0
#P amazon
Index: amazon.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon/amazon.admin.inc,v
retrieving revision 1.9
diff -u -r1.9 amazon.admin.inc
--- amazon.admin.inc	28 Nov 2010 17:42:13 -0000	1.9
+++ amazon.admin.inc	7 Feb 2011 12:28:21 -0000
@@ -22,6 +22,11 @@
     '#description' => t('Amazon.com uses separate product databases and Ecommerce features in different locales; pricing and availability information, as well as product categorization, differs from one locale to the next. Be sure to select the locale your site will be running in.'),
   );
 
+  $form['amazon_locale_old'] = array(
+    '#type' => 'value',
+    '#value' => variable_get('amazon_locale', 'US'),
+  );
+
   $form['associate_setting'] = array(
     '#type' => 'fieldset',
     '#title' => t('Amazon referral settings'),
@@ -66,8 +71,19 @@
     '#default_value' => variable_get('amazon_aws_secret_access_key', ""),
     '#required' => TRUE,
   );
+  
+  $form = system_settings_form($form);
+  $form['#submit'][] = 'amazon_settings_form_submit';
+  return $form;
+}
 
-  return system_settings_form($form);
+/**
+ * Rebuild menu when settings submitted, as they might have changed the menu.
+ */
+function amazon_settings_form_submit($form, &$form_state) {
+  if ($form_state['values']['amazon_locale'] != $form_state['values']['amazon_locale_old']) {
+    module_invoke_all('amazon_locale', $form_state['values']['amazon_locale']);
+	}
 }
 
 /**
#P amazon_store
Index: amazon_store.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/amazon_store.module,v
retrieving revision 1.39
diff -u -r1.39 amazon_store.module
--- amazon_store.module	7 Feb 2011 02:41:08 -0000	1.39
+++ amazon_store.module	7 Feb 2011 12:28:24 -0000
@@ -248,6 +248,17 @@
   return $forms;
 }
 
+/**
+ * Implements hook_amazon_locale().
+ */
+function amazon_store_amazon_locale($locale) {
+	drupal_set_message(t('You have changed the Amazon locale to %locale. Therefore some <a href="@link">Amazon store settings</a> have been reset and need to be reconfigured.', array('%locale' => $locale, '@link' => url('admin/config/amazon_settings/amazon_store'))), 'warning');
+  $GLOBALS['amazon_store_search_indexes'] = new SearchIndexes($locale);
+  variable_set('amazon_store_search_index_choice', 'Books');
+  variable_set('amazon_store_default_search_index', 'Books');
+  variable_set('amazon_store_include_categories', $GLOBALS['amazon_store_search_indexes']->getRecommendedCategories());
+  variable_set('amazon_store_default_browsenode_id', '');
+}
 
 /**
  * Implement hook_ctools_include_directory().
Index: searchindexes.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/searchindexes.inc,v
retrieving revision 1.13
diff -u -r1.13 searchindexes.inc
--- searchindexes.inc	27 Jan 2011 23:45:25 -0000	1.13
+++ searchindexes.inc	7 Feb 2011 12:28:24 -0000
@@ -28,10 +28,11 @@
    * @return unknown_type
    */
   function __construct($locale) {
-    $locale_file = '/locales/amazon_store.locale.' . strtolower($locale);
-    module_load_include('inc', 'amazon_store', $locale_file);
-
-    $this->data = _amazon_store_locale();
+	  $locale_file = '/locales/amazon_store.locale.' . strtolower($locale);
+	  module_load_include('inc', 'amazon_store', $locale_file);
+	  
+  	$locale_function = '_amazon_store_locale_' . strtolower($locale);
+  	$this->data = call_user_func($locale_function);
 
     if (!empty($this->data[$locale])) {
       foreach ($this->data[$locale] as $index => $item) {
Index: locales/amazon_store.locale.ca.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/locales/amazon_store.locale.ca.inc,v
retrieving revision 1.5
diff -u -r1.5 amazon_store.locale.ca.inc
--- locales/amazon_store.locale.ca.inc	8 Apr 2010 05:35:51 -0000	1.5
+++ locales/amazon_store.locale.ca.inc	7 Feb 2011 12:28:24 -0000
@@ -1,8 +1,6 @@
 <?php
 
-function _amazon_store_locale() {
-
-
+function _amazon_store_locale_ca() {
   $locale = array(
   'CA' => array(
       'All' => array('friendly_name' => t('All'),
Index: locales/amazon_store.locale.de.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/locales/amazon_store.locale.de.inc,v
retrieving revision 1.5
diff -u -r1.5 amazon_store.locale.de.inc
--- locales/amazon_store.locale.de.inc	8 Apr 2010 05:35:51 -0000	1.5
+++ locales/amazon_store.locale.de.inc	7 Feb 2011 12:28:24 -0000
@@ -10,7 +10,7 @@
  * http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?APPNDX_SortValuesArticle.html
  */
 
-function _amazon_store_locale() {
+function _amazon_store_locale_de() {
   $locale = array(
 'DE' => array(
    'All' => array('friendly_name' => t('All'),
Index: locales/amazon_store.locale.fr.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/locales/amazon_store.locale.fr.inc,v
retrieving revision 1.5
diff -u -r1.5 amazon_store.locale.fr.inc
--- locales/amazon_store.locale.fr.inc	8 Apr 2010 05:35:51 -0000	1.5
+++ locales/amazon_store.locale.fr.inc	7 Feb 2011 12:28:24 -0000
@@ -1,7 +1,7 @@
 <?php
 
 
-function _amazon_store_locale() {
+function _amazon_store_locale_fr() {
 
   $locale = array('FR' => array(
       'All' => array('friendly_name' => t('All'),
Index: locales/amazon_store.locale.jp.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/locales/amazon_store.locale.jp.inc,v
retrieving revision 1.4
diff -u -r1.4 amazon_store.locale.jp.inc
--- locales/amazon_store.locale.jp.inc	8 Apr 2010 05:35:51 -0000	1.4
+++ locales/amazon_store.locale.jp.inc	7 Feb 2011 12:28:25 -0000
@@ -1,7 +1,7 @@
 <?php
 
 
-function _amazon_store_locale() {
+function _amazon_store_locale_jp() {
 
   $locale = array('JP' => array(
     'All' => array('friendly_name' => t('All'),
Index: locales/amazon_store.locale.uk.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/locales/amazon_store.locale.uk.inc,v
retrieving revision 1.6
diff -u -r1.6 amazon_store.locale.uk.inc
--- locales/amazon_store.locale.uk.inc	8 Apr 2010 05:35:51 -0000	1.6
+++ locales/amazon_store.locale.uk.inc	7 Feb 2011 12:28:25 -0000
@@ -12,7 +12,7 @@
  * No parameters_allowed or sorts information available for Sporting Goods or Tools - used US Info
  */
 
-function _amazon_store_locale() {
+function _amazon_store_locale_uk() {
   $locale = array('UK' => array(
     'All' => array('friendly_name' => t('All'),
   'BrowseNode' => 2000,
Index: locales/amazon_store.locale.us.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/amazon_store/locales/amazon_store.locale.us.inc,v
retrieving revision 1.5
diff -u -r1.5 amazon_store.locale.us.inc
--- locales/amazon_store.locale.us.inc	8 Apr 2010 05:35:51 -0000	1.5
+++ locales/amazon_store.locale.us.inc	7 Feb 2011 12:28:26 -0000
@@ -1,6 +1,6 @@
 <?php
 
-function _amazon_store_locale() {
+function _amazon_store_locale_us() {
 
   $locale = array('US' => array(
   'All' => array('friendly_name' => t('All'),
