### Eclipse Workspace Patch 1.0
#P www.admb.be
Index: export_menu_to_xml.module
===================================================================
--- export_menu_to_xml.module	(revision 224)
+++ export_menu_to_xml.module	(working copy)
@@ -27,11 +27,30 @@
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
+  
+  if (module_exists('i18nmenu')) {
+    $items['admin/settings/export_menu_to_xml'] = array(
+      'title' => 'Export menu to XML',
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array('export_menu_to_xml_admin_settings'),
+      'access arguments' => array('administer export menu to xml'),
+      'type' => MENU_NORMAL_ITEM,
+    );
+  }
 
   return $items;
 }
 
 /**
+ * Implementation of hook_perm().
+ *
+ * @return array An array of valid permissions for the export_menu_to_xml module
+ */
+function export_menu_to_xml_perm() {
+  return array('administer export menu to xml');
+}
+
+/**
  * Otput the menu in xml format
  */
 function export_menu_to_xml_output() {
@@ -43,6 +62,12 @@
 	foreach ($names as $name) {
 	  print "<menu name=\"$name\">\n";
 	  $data = menu_tree_all_data($name);
+	  
+	  //Localize the tree if admin setting is on
+	  if (variable_get('export_menu_to_xml_localize', 0) != 0) {
+	    i18nmenu_localize_tree($data);
+	  }
+	  
 	  foreach ($data as $item) {
 		  _export_menu_to_xml_output_link($item, 1);
 	  }
@@ -67,4 +92,20 @@
 		}
 	}
     print "$tab</item>\n";
+}
+
+/**
+ * Admin form
+ */
+function export_menu_to_xml_admin_settings() {
+  $form = array();
+  
+  $form['export_menu_to_xml_localize'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Localize output'),
+    '#description' => t('When checking this box, the output of the XML file will be localized against the current user language'),
+    '#default_value' => variable_get('export_menu_to_xml_localize', 0),
+  );
+  
+  return system_settings_form($form);
 }
\ No newline at end of file
