Index: src/test/java/com/xpn/xwiki/web/XWikiMessageToolTest.java
===================================================================
--- src/test/java/com/xpn/xwiki/web/XWikiMessageToolTest.java	(revision 8455)
+++ src/test/java/com/xpn/xwiki/web/XWikiMessageToolTest.java	(working copy)
@@ -40,10 +40,12 @@
 {
     private Mock mockXWiki;
     private XWikiMessageTool tool;
+    private XWikiContext context;
 
     protected void setUp()
     {
-        this.tool = new XWikiMessageTool(new TestResources(), createXWikiContext());
+        this.context = createXWikiContext();
+        this.tool = new XWikiMessageTool(new TestResources(), context);
     }
 
     public class TestResources extends ListResourceBundle
@@ -65,6 +67,7 @@
     {
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
         this.mockXWiki.stubs().method("Param").will(returnValue(null));
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
 
         assertEquals("invalid", this.tool.get("invalid"));
     }
@@ -73,6 +76,7 @@
     {
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
         this.mockXWiki.stubs().method("Param").will(returnValue(null));
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
 
         assertEquals("value", this.tool.get("key"));
     }
@@ -83,10 +87,11 @@
     public void testGetWhenKeyIsNull()
     {
         assertNull(this.tool.get(null));
-    }
+    } 
 
     public void testGetWhenInXWikiPreferences()
     {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
         this.mockXWiki.stubs().method("getXWikiPreference").will(
             returnValue("Space1.Doc1, Space2.Doc2"));
         this.mockXWiki.stubs().method("getDocument").with(eq("Space1.Doc1"), ANYTHING)
@@ -100,6 +105,7 @@
 
     public void testGetWhenInXWikiConfigurationFile()
     {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
         this.mockXWiki.stubs().method("Param").will(returnValue("Space1.Doc1"));
         this.mockXWiki.stubs().method("getDocument").with(eq("Space1.Doc1"), ANYTHING)
@@ -114,6 +120,7 @@
      */
     public void testGetWithParameters()
     {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
         this.mockXWiki.stubs().method("Param").will(returnValue("Space1.Doc1"));
         this.mockXWiki.stubs().method("getDocument").with(eq("Space1.Doc1"), ANYTHING)
@@ -133,6 +140,7 @@
      */
     public void testGetDocumentBundlesWhenDocumentDoesNotExist()
     {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue("Space1.Doc1"));
         this.mockXWiki.stubs().method("getDocument").with(eq("Space1.Doc1"), ANYTHING)
             .will(returnValue(createDocument(111111L, "Space1.Doc1", "", true)));
@@ -142,6 +150,7 @@
 
     public void testGetReturnsFromCacheWhenCalledTwice()
     {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue("Space1.Doc1"));
 
         Mock document = createMockDocument(11111L, "Space1.Doc1", "key=value", false);
@@ -160,6 +169,7 @@
 
     public void testGetWhenDocumentModifiedAfterItIsInCache()
     {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
         this.mockXWiki.stubs().method("getXWikiPreference").will(returnValue("Space1.Doc1"));
 
         Mock document = createMockDocument(11111L, "Space1.Doc1", "key=value", false);
@@ -180,6 +190,25 @@
         assertEquals("found", this.tool.get("modifiedKey"));
     }
 
+    public void testGetWhenWithTranslation()
+    {
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("en"));
+        this.mockXWiki.stubs().method("getXWikiPreference").will(
+            returnValue("Space1.Doc1"));
+        this.mockXWiki.stubs().method("getDocument").with(eq("Space1.Doc1"), ANYTHING)
+            .will(returnValue(createDocumentWithTrans(111111L, "Space1.Doc1", "somekey=somevalue\nsomekey2=somevalue2" , "somekey=somevaluetrans", false)));
+
+        this.context.setLanguage("en");
+        assertEquals("somevalue", this.tool.get("somekey"));
+        assertEquals("somevalue2", this.tool.get("somekey2"));
+
+        // Switch to french
+        this.context.setLanguage("fr");
+        this.mockXWiki.stubs().method("getDefaultLanguage").will(returnValue("fr"));
+        assertEquals("somevaluetrans", this.tool.get("somekey"));
+        assertEquals("somevalue2", this.tool.get("somekey2"));
+    }
+
     private XWikiDocument createDocument(long id, String name, String content, boolean isNew)
     {
         return (XWikiDocument) createMockDocument(id, name, content, isNew).proxy();
@@ -195,9 +224,44 @@
         mockDocument.stubs().method("getDate").will(returnValue(new Date()));
         mockDocument.stubs().method("getContent").will(returnValue(content));
         mockDocument.stubs().method("getFullName").will(returnValue(name));
+        mockDocument.stubs().method("getRealLanguage").will(returnValue("en"));
         return mockDocument;
     }
 
+
+    private XWikiDocument createDocumentWithTrans(long id, String name, String content,String transContent, boolean isNew)
+    {
+        return (XWikiDocument) createMockDocumentWithTrans(id, name, content, transContent, isNew).proxy();
+    }
+
+    private Mock createMockDocumentWithTrans(long id, String name, String content, String transContent, boolean isNew)
+    {
+        Mock mockDocument = mock(XWikiDocument.class);
+        Mock mockTransDocument = mock(XWikiDocument.class);
+        XWikiDocument transdocument = (XWikiDocument) mockTransDocument.proxy();
+        XWikiDocument document = (XWikiDocument) mockDocument.proxy();
+        mockDocument.stubs().method("getTranslatedDocument").will(returnValue(document));
+        mockDocument.stubs().method("getTranslatedDocument").with(eq("fr")).will(returnValue(transdocument));
+        mockDocument.stubs().method("isNew").will(returnValue(isNew));
+        mockDocument.stubs().method("getId").will(returnValue(new Long(id)));
+        mockDocument.stubs().method("getDate").will(returnValue(new Date()));
+        mockDocument.stubs().method("getContent").will(returnValue(content));
+        mockDocument.stubs().method("getFullName").will(returnValue(name));
+        mockDocument.stubs().method("getLanguage").will(returnValue(""));
+        mockDocument.stubs().method("getDefaultLanguage").will(returnValue("en"));
+        mockDocument.stubs().method("getRealLanguage").will(returnValue("en"));
+        mockTransDocument.stubs().method("getTranslatedDocument").will(returnValue(transdocument));
+        mockTransDocument.stubs().method("isNew").will(returnValue(isNew));
+        mockTransDocument.stubs().method("getId").will(returnValue(new Long(id)));
+        mockTransDocument.stubs().method("getDate").will(returnValue(new Date()));
+        mockTransDocument.stubs().method("getContent").will(returnValue(transContent));
+        mockTransDocument.stubs().method("getFullName").will(returnValue(name));
+        mockTransDocument.stubs().method("getDefaultLanguage").will(returnValue("en"));
+        mockTransDocument.stubs().method("getLanguage").will(returnValue("fr"));
+        mockTransDocument.stubs().method("getRealLanguage").will(returnValue("fr"));
+        return mockDocument;
+    }
+
     private XWikiContext createXWikiContext()
     {
         XWikiContext context = new XWikiContext();
Index: src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- src/main/java/com/xpn/xwiki/XWiki.java	(revision 8455)
+++ src/main/java/com/xpn/xwiki/XWiki.java	(working copy)
@@ -1793,14 +1793,9 @@
         String language = context.getLanguage();
         if (language != null)
             return language;
+        
+        String defaultLanguage = getDefaultLanguage(context);
 
-        // Find out what is the default language from the XWiki preferences settings.
-        String defaultLanguage =
-            context.getWiki().getXWikiPreference("default_language", "", context);
-        if (defaultLanguage == null || defaultLanguage.equals("")) {
-            defaultLanguage = "en";
-        }
-
         // If the wiki is non multilingual then the language is the default language.
         if (!context.getWiki().isMultiLingual(context)) {
             language = defaultLanguage;
@@ -1879,6 +1874,16 @@
         return defaultLanguage;
     }
 
+    public String getDefaultLanguage(XWikiContext context) {
+        // Find out what is the default language from the XWiki preferences settings.
+        String defaultLanguage =
+            context.getWiki().getXWikiPreference("default_language", "", context);
+        if (defaultLanguage == null || defaultLanguage.equals("")) {
+            defaultLanguage = "en";
+        }
+        return defaultLanguage;
+    }
+
     public String getDocLanguagePreferenceNew(XWikiContext context)
     {
         // Get context language
Index: src/main/java/com/xpn/xwiki/web/XWikiMessageTool.java
===================================================================
--- src/main/java/com/xpn/xwiki/web/XWikiMessageTool.java	(revision 8455)
+++ src/main/java/com/xpn/xwiki/web/XWikiMessageTool.java	(working copy)
@@ -198,30 +198,34 @@
      * @see com.xpn.xwiki.web.XWikiMessageTool for more details on the algorithm used to find the
      *      document bundles
      */
-    protected List getDocumentBundles()
+    public List getDocumentBundles()
     {
+        String defaultLanguage = context.getWiki().getDefaultLanguage(context);
         List result = new ArrayList();
         Iterator docNames = getDocumentBundleNames().iterator();
         while (docNames.hasNext()) {
             String docName = ((String) docNames.next()).trim();
-            XWikiDocument docBundle = getDocumentBundle(docName);
-            if (docBundle != null) {
-                if (!docBundle.isNew()) {
-                    // Checks for a name update
-                    Long docId = new Long(docBundle.getId());
-                    Date docDate = docBundle.getDate();
-                    // Check for a doc modification
-                    if (!docDate.equals(this.previousDates.get(docId))) {
-                        this.docsToRefresh.add(docId);
-                        this.previousDates.put(docId, docDate);
+            List docBundles = getDocumentBundles(docName, defaultLanguage);
+            for (int i=0;i<docBundles.size();i++) {
+                XWikiDocument docBundle = (XWikiDocument) docBundles.get(i);
+                if (docBundle != null) {
+                    if (!docBundle.isNew()) {
+                        // Checks for a name update
+                        Long docId = new Long(docBundle.getId());
+                        Date docDate = docBundle.getDate();
+                        // Check for a doc modification
+                        if (!docDate.equals(this.previousDates.get(docId))) {
+                            this.docsToRefresh.add(docId);
+                            this.previousDates.put(docId, docDate);
+                        }
+                        result.add(docBundle);
+                    } else {
+                        // The document listed as a document bundle doesn't exist. Do nothing
+                        // and log.
+                        LOG.warn("The document [" + docBundle.getFullName() + "] is listed "
+                                + "as an internationalization document bundle but it does not "
+                                + "exist.");
                     }
-                    result.add(docBundle);
-                } else {
-                    // The document listed as a document bundle doesn't exist. Do nothing
-                    // and log.
-                    LOG.warn("The document [" + docBundle.getFullName() + "] is listed "
-                        + "as an internationalization document bundle but it does not "
-                        + "exist.");
                 }
             }
         }
@@ -236,7 +240,7 @@
      * @return the document object corresponding to the passed document's name. A translated version
      *         of the document for the current Locale is looked for.
      */
-    private XWikiDocument getDocumentBundle(String documentName)
+    public XWikiDocument getDocumentBundle(String documentName)
     {
         XWikiDocument docBundle;
 
@@ -260,13 +264,47 @@
         return docBundle;
     }
 
-    /**
-     * @param docBundle the resource bundle document containing Translation Resources
-     * @return the properties found in the passed resource bundle document. A translated version
+
+     /**
+     * Helper method to help get a translated version of a document. It handles any exception
+     * raised to make it easy to use.
+     *
+     * @param documentName the document's name (eg Space.Document)
+     * @return the document object corresponding to the passed document's name. A translated version
      *         of the document for the current Locale is looked for.
      */
-    public Properties getDocumentBundleProperties(XWikiDocument docBundle)
+    public List getDocumentBundles(String documentName, String defaultLanguage)
     {
+        ArrayList list = new ArrayList();
+
+        if (documentName.length() == 0) {
+            return list;
+        } else {
+            try {
+                // First, looks for a document suffixed by the language
+                XWikiDocument docBundle = this.context.getWiki().getDocument(documentName, this.context);
+                XWikiDocument tdocBundle = docBundle.getTranslatedDocument(this.context);
+                list.add(tdocBundle);
+                if (!tdocBundle.getRealLanguage().equals(defaultLanguage)) {
+                    XWikiDocument defdocBundle = docBundle.getTranslatedDocument(defaultLanguage, this.context);
+                    if (tdocBundle!=defdocBundle)
+                     list.add(defdocBundle);
+                }
+
+            } catch (XWikiException e) {
+                // Error while loading the document.
+                // TODO: A runtime exception should be thrown that will bubble up till the
+                // topmost level. For now simply log the error
+                LOG.error("Failed to load internationalization document bundle [" + documentName
+                    + "].", e);
+                return list;
+            }
+        }
+
+        return list;
+    }
+
+    public Properties getDocumentBundleProperties(XWikiDocument docBundle) {
         Properties props = new Properties();
         String content = docBundle.getContent();
         byte[] docContent;
