Here is a simple solution to add node translation to Drupal core, majority of work by Jose A Reyero.
Let me point out straight that we are only thinking in terms of node copies for this release cycle, no direct solution for shared data among nodes. With different node instances for translations, people could have comments, revisions, authors, workflows, views, etc. differently for translations. Those wishing shared data between nodes, but are not interested in having standalone node instances can take a look at our 'object translation' feature, which can be finely used to provide translation with shared data for nodes (but without the possibility to have different workflows, authors, revisions, etc). The object translation feature needs so many core modifications that we are concentrating on that first, instead of being able to shared fields between node translation instances (which we believe is a CCK-level feature requirement). It should also be pointed out however, that there is nothing here to prevent from a contributed module to implement shared fields, we just prefill fields initially, and allow other modules to hook into our processes and do whatever they wish.
So the attached patch does the following:
1. Introduction of translation sets. A node can be part of one translation set, of which the first associated node is regarded as a "source node".
2. Nodes have their "translation source revision" stored in the translation set, so if the source node has a new revision created, we can inform translators that their translations are outdated. Now if a translation node is modified, it is marked as being fully updated to the actual source node, which might not be the case in real life with translation modifications. Contributed modules can hook into the node form to alter this behavior, providing controls to the user to tell the code what is really updated in the text.
3. On the UI, we add a translation tab on nodes where language is enabled and the node itself is not language neutral. This tab shows an overview page, which allows creation of new translations as well as overview of existing translations.
4. Nodes get "translation links" in the node links array, so users can switch to different language versions. This is of course themeable.
5. When a new translation node is created, body and title are prefilled with the source body and title. We have a nodeapi extension in place for other modules to prefill other fields of translation nodes.
The following TODOs are in the code, which need some discussion:
* An option to toggle translation links for content types? Like we have toggles for author info.
* Native names for languages in node links? Or translated names in the language used, or both? Now we have translated links. Only themers can alter that now.
* Help text and documentation! Obviously we need docs for the "translate" tab, once basic things are settled.
* New content type setting, to enable translation per node type? Like we have "language enabled" node types now.
* What if we want to add an existing node to a translation set? hook_nodeapi() update and delete operations are ready for this, but we have no UI yet. This might be interesting for people upgrading, maybe having nodes which were in fact translations of each other but never marked as such. Otherwise i18n module and localizer module will need to provide their upgrade scripts to users.
* Admin overview interface for translations not included, because unfortunately it is mostly copy-paste of the node admin overview (which is not modular enough yet). Maybe Roberto Gerola has something to share in this front, but that can definitely be a separate patch.
Note, that this patch puts translation module into node module's folder because I was unable to find out how to do a patch with adding a new directory (cvs diff was throwing lock errors at me). Of course the final place of translation module will be a dedicated folder, but for testing and review, this is fine.
Let's first decide if Drupal 6 needs such a built-in module at all, or should we postpone it for Drupal 7 and/or a contributed module altogether! We have a lot of issues on our hands, lot of stuff to get completed in the Drupal 6 timeframe on the multilanguage front, so we'd better concentrate on what is likely to get enough acceptance.
|translate_module.patch||12.07 KB||Ignored: Check issue status.||None||None|