--- Downloads/tagadelic/tagadelic.module	2009-03-29 13:52:40.000000000 +0100
+++ Sites/oxfam/svn_repos/drupal5core/sites/all/modules/tagadelic/tagadelic.module	2009-09-29 11:42:32.000000000 +0100
@@ -207,6 +207,12 @@ function tagadelic_get_weighted_tags($vi
   // build the options so we can cache multiple versions
   $options = implode($vids) .'_'. $steps .'_'. $size;
   
+  //Check if we have a cache of multi-lingual tags
+  if (module_exists('i18n') && module_exists('i18ntaxonomy')) {
+    $lang = i18n_get_lang();
+    $options .= '_'. $lang;
+  }
+  
   // Check if the cache exists
   $cache_name = 'tagadelic_cache_'. $options;
   $cache = cache_get($cache_name);
@@ -220,7 +226,11 @@ function tagadelic_get_weighted_tags($vi
     if (!is_array($vids) || count($vids) == 0) {
       return array();
     }
-    $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .') GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
+    // Check if we have to deal with multi-lingual tags
+    if ($lang) {
+      $where = " AND d.language = '". $lang ."'";
+    }
+    $result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN ('. substr(str_repeat('%d,', count($vids)), 0, -1) .')'. $where .' GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', $vids, 0, $size);
 
     $tags = tagadelic_build_weighted_tags($result, $steps);
     
