Working with the Domain Access module
One of our clients at ICanLocalize has a number of sites that rely heavily on the Domain Access module. We thought that we had tested our ICanLocalize Translator module thoroughly with this module but nothing replaces a real live test.
For those that are not aware:
The Domain Access project is a suite of modules that provide tools for running a group of affiliated sites from one Drupal installation and a single shared database.
Problems found
1. ICanLocalize returned translations to the wrong domain.
What should happen here is that the all the translations of a node should be published in the same domain as the original node. What we found was that the domain information was not being saved at all for the translated nodes. After tracing through the code I found that all the domain information for a node was set correctly when calling node_save() but was not being saved to the domain access tables. It turns out that the Domain Access module was caching some of its data and the cached values where not always correct due to the way our module was accessing the saved node at a later stage. See http://drupal.org/node/752570 for details.
We managed to fix this with the changes kindly done by the maintainer of the Domain Access module and changing the order of things in our ICanLocalize translator module.
2. Duplicate translated nodes were being created.
What was happening was that when an updated translation was being saved by the ICanLocalize Translator module, it was creating a completely new node instead of updating the content of translated node. It seemed that our module could not determine that the node was already translated. With the help of the client we checked what was in the database and what was returned by the function translation_node_get_translations. All appeared to be OK so why was it going wrong? Our module calls translation_node_get_translations to find the translated nodes. When the client ran it, it returned the translated nodes but when it was called from the ICanLocalize Translator module, didn't return any translations.
After a bit of head scratching it dawned on me that maybe it was another Domain Access issue. When we send back translations from the ICanLocalize server they get sent back via XML-RPC. When the XML-RPC function gets called it runs in the default domain so calling translation_node_get_translations returns none because the Domain Access module determines the original node was in a different domain.
To fix this I created our own version of the "translation_node_get_translations" that bypasses Domain Access filtering of nodes.
Conclusion
ICanLocalize Translator should now work much better with the Domain Access module thanks to our client and the maintainer of the Domain Access module.
Domain Access is a powerful module and we intend to use it to deliver other client sites that require complex configurations. It's great to know that things work together now.

Comments
Using domain access module
I have to use domain access module for handling multiple sites.
While calling menu tree I am geting nothing as response for another domain.But I am getting the tree for main domain.Reply if you have any idea.I am using the function display_menu_tree() for calling menu items.
Thanks
I used the first method
I used the first method 70-432 for my English/Japanese site but all it did was show me two menu items. One in English and the other 70-431 in Japanese. This even when I was not logged in as admin.I did not try the second method since trying to find the node address of all my menu pages is too much of a 70-297pain.I used the first method for my English/Japanese site but all it did was show me two menu items. One in English and the other in Japanese. This even when I was not logged in as admin.I did not 70-294 try the second method since trying to find the node address of all my menu pages is too much of a pain.
Post new comment