I'm interested in using drupal as a CMS for a Canadian website. As such, I need to be able to provide two versions of most nodes: an english version, and a french version (ie, one is a simple translation of the other). It would be ideal if this was implemented at a level below the modules, so that mods wouldn't have to be language aware.

Does anyone have an idea how to (cleanly) implement this feature?

My uneducated guess at an implementation would be to create a function i18n_load($type, $node) that would load a node in the current language. It would first try to call the hook _i18n_load (or somesuch) that would be responsible for loading the named node in the named language (defaulting to the current language). If that hook isn't provided, _i18n_multilingual_fields would be called, which would return a list of the multilingual fields associated with the node - which i18n_load(...) would then use to construct a query on a specially named table.

A similar architecture could be built for an i18n_insert() and update -- both of which could be over-ridden with similar hooks.

Thoughts?

Comments

Lappie’s picture

Sure, use the locales module, I think it exactly does what you want it to. Although I have not yet used it myself (I need a Dutch translation), you just need to activate the module, create an additional entry in your conf.php (IIRC; described in the installation instructions) and then you can translate all strings of drupal somewhere in your admin menu.

ullgren’s picture

I don't know if this was what the original poster meant bu I would realy like to see support for multi-language nodes. Not locales (whioch is great but only to translate the interface strings) but to be able to have translated content of the pages/polls...

I've got one or two ideas how this could be implemented.
I don't know which would be the best one.
A) Implement as a stand alone module. That provides a relation between nodes. This would mean that if I want a swedish and a english version of a page-node I create two (2) nodes that are linked by the i18n module. This module must be able to intercept _load calls so that the right node data is loaded depending on language setting. Can this be done ? Maybe one could add an extra "hook" for _nodeapi that is called when a node is loaded so a module can add or override the node data.

B) Code it into drupal core. Add a lang column to the node table and have drupal store a version of the node for each language. The primary key for the node table would then be nid,lang.
This would demand a lot of recoding/patching of the core and additional modules.

carry’s picture

A multiple language user interface is needed as well, but the REAL challenge for a CMS lies in the content part.
Think also about shareable non-language related content like images (provided it's not a button with text on it, then it can be language dependant).

I've searched for CMS systems that support multiple language content.
Sofar I've seen a promisong yet maybe a bit too academic still, Ariadne at http://ariadne.muze.nl/ and a simple one SaveWebPortal at http://www.itworking.com/

If drupal can meet the challenge?
Let's see what it brings!

adamrice’s picture

Ideally for this purpose, one would have a button in the Drupal editing interface that created a new text box for entering a version of the node in a different language, plus popup menus to specify the language used.

In the meantime, however, one can write everything in one textbox, and set off each language version as such:

<div lang="en"> English content here </div>

<div lang="fr"> French content here </div>

To switch between languages, you can use a snippet of code to activate one or another stylesheet (A List Apart has discussed PHP stylesheet switching; this could also be done using javascript). One stylesheet would contain:
div:lang(en) {display: none;}
div:lang(fr) {display: block;}

The other stylesheet would be the reverse.

Adam Rice

koorneef’s picture

The dutch translation in the contributions CVS is not very practical (being a sql dump, and not being very complete). Using the localegettext module a more sensible and editable translation file can be made.

See also: Import and export translations using PO files
and localegettext module

If somebody already has a pot file for dutch lying around please share it ! Translating is a very dull job !

Bèr Kessels’s picture

My multilingual.module in my sandbox (http://cvs.drupal.org/viewcvs/contributions/sandbox/ber/multilingual/mul...)
achieves more languages on drupal.

I had to code it under great time-pressure, so its not at all finished. E.G. the administration still needs a 'to translate' queue and lots of code needs to be cleaned. But first the textboxes should be replaced by a dopdown select box.
But the idea is simple and it works!

Ber
Mediarevolution.org :: het platform voor online muziek

e-1’s picture

Does this module create links between nodes that all have the same content? Does this mean that the modules have to be created seperately? Is their content is duplicated?

e

SupaDucta’s picture

Erm, could you post an SQL query that creates the multilingual table?

jose reyero’s picture

I've released this i18n module, which is in the contributions/modules folder. It provides interface translation for anonymous users -with a block to select language- and a simple approach to content translation.

For now, as I didn't want to patch the core modules, I use url rewriting and url aliasing for content translation. I create different path alias for the same node in different languages: en/node, es/node.....

nuwonda’s picture

i am looking for a multilanguage solution also. it seems no CMS to date (expect for plone with its PO files) offers this in a satisfactory way. surprisingly so.

what is the status on "content" multilanguage functionality in drupal so far?

SupaDucta’s picture

TYPO3 does offer multilanguage functionality.

It's old approach was a multiple-tree structure (basically what we talk about here as 'not-quite satisfactory'), but now also offers a single-tree structure with 'translate this page' options.

I haven't explored it enough yet, but seems like a pretty serious approach at first glance. I am exploring it, because I need to make a multilingual site. I would like to use Drupal, but this seems more refined and powerful.

However, Drupal SHOULD have multiple language content. Drupal is too good and too serious not to.

beorn’s picture

I know it's not a smart way to do things, but an easy way to have multi-language content (not at all structure for Drupal's messages) is to add a vocabulary which may be called "language", and with terms "English", "French", "Russian", and so on. This vocabulary should be created as Required, so that every node in Drupal must have a language associated with it.

This is so far, about content. But what doesn't really look too serious is to have mixed languages. I mean, content, in Spanish, for example, and Drupal's messages in just one language. It doesn't need to be English. It can be localized, but the point is not this. The point is to have multi-language structure.

I have still never found here anything really explaining how to do this. I think it's something that many people need as to adopt Drupal (Mambo does it already). Does anyone know about a way to solve this, without needing to touch too much or too many core files?