Tutorial - Building a multi-language site

auris - June 27, 2008 - 14:12

The following steps are for those who want to have a simple site available in deferent languages. The goal is to have content translated to two or more languages and the visitor to be able to choose any of them. Also, the menus must follow the selection. I have tested the result with content types page and story. I don't know what happens with forum, for example. I hope this helps you.

In the parentheses I give the relative path in the url. So, if your site is http://example.com/drupal and in parentheses I give admin/build/modules, then the url becomes: http://example.com/drupal/admin/build/modules

  1. Install Internationalization module
  2. Go to the modules (admin/build/modules) and in Core - optional section enable
    • Locale
    • Content translation
  3. In the Multilanguage - i18n section enable all available. If you haven't enabled Poll and Profile modules, Drupal asks you if you want them enabled. If you don't want them, in the Multilanguage - i18n don't enable Multilanguage Poll and Multilanguage Profile.
  4. Save

You now need the translation files for all the available languages of your site (if you haven't got them already). Go to the translations page and download. Then extract them to Drupal's folder (see at 2 minutes 30 seconds into this videocast for the correct way to extract translations; you can ignore the rest of the video as it deals with installing Drupal in a language other than English, while this page deals with adding a language after Drupal has already been installed).

You have to add this language:

  1. Go to the Languages page (admin/settings/language)
    • Add all the languages you downloaded and extracted (admin/settings/language/add)
    • Choose Configure
    • In the Language negotiation choose Path prefix only and save settings
  2. Make sure English is the default language
  3. Go to the blocks (admin/build/block)
  4. In the Disabled area choose a Region for the Language switcher
  5. Choose Save blocks

Ok, now you are at a good point. Choosing a language from the Language switcher, the Built-in interface changes to the corresponding language! If it doesn't make sure that it is translated. For that, navigate to admin/build/translate and check the ratio. It must be close to 100%.

The next steps are to make multilingual content.

  1. Enable Multilingual support for all content types you want (admin/content/types)
    • Choose edit for the content type you want (e.g page)
    • In the Workflow settings choose Enabled, with translation and save
  2. Now create content for the content type you have enabled multilingual support (e.g a page) (node/add/page)
  3. In the Language field choose English
  4. Save the page
  5. Choose the Translate link
  6. Choose add translation for the language you want
  7. Write the page. The value in the Language field should show the selected language and be disabled/greyed out.
  8. Save

Now you should be able to switch between translations when viewing the page by using the Language switcher block.

You might want to use flags instead, in which case you'll need the Language Icons module.

For your site to be fully translated you need to have the menus translated. You have two options!

  1. Build a menu for every available language
  2. Build one menu with links that point to every available language. What I mean is that if node/1 is your home page in English and node/2 in Greek, in your menu you have to make a link to node/1 named "Home Page" and one to node/2 named "Αρχική Σελίδα" (this is home page in Greek). You have to do this for every multilingual page.

Try both options and choose what is best for you.

1st option (multiple menus)

  1. Add a new menu (admin/build/menu/add)
  2. In the Menu name give a name, e.g. en-menu
  3. Give title, description and Save
  4. Add an item (admin/build/menu-customize/menu-en-menu/add)
  5. Give the path for the English page (node/1)
  6. Give the English name for the link
  7. In the Language combo box you don't have to choose a language!
  8. Save
  9. Add a new menu for the second language (admin/build/menu/add)
  10. In the Menu name give a name, e.g. el-menu
  11. Add an item (admin/build/menu-customize/menu-el-menu/add)
  12. Give the path (node/2), name and save
  13. Use the same procedure to build menus for all the available languages you have

Ok, you now have your menus. Let's display them.

  1. Go to the blocks (admin/build/block)
  2. Go the the Disabled area and choose a Region for your menus
  3. Choose Save blocks
  4. For your English menu choose configure under Operations column
  5. In the Multilingual settings choose English as language and save
  6. Do the same for the rest menus and choose the appropriate language

2nd option (one menu)

  1. Add a new menu (admin/build/menu/add)
  2. In the Menu name give a name, e.g. multi-menu
  3. Give title, description and Save
  4. Add an item (admin/build/menu-customize/menu-multi-menu/add)
  5. Give the path for the English page (node/1)
  6. Give the English name for the link
  7. In the Language combo box choose English
  8. Save
  9. Add another item (admin/build/menu-customize/menu-el-menu/add)
  10. Give the path (node/2) and name
  11. In the Language combo box choose your language, e.g. Greek
  12. Save
  13. Do the same if node/1 is translated to more languages
  14. Use the same procedure to build menus links for all the available pages you have multilingual

Now, display your menu

  1. Go to the blocks (admin/build/block)
  2. Go the the Disabled area and choose a Region for your menu
  3. Choose Save blocks

Done! Now, when you choose a language on the language switcher, you should see the content translated and the correct menu.

Well done. Nice, clear

-Anti- - June 27, 2008 - 14:38

Well done. Nice, clear tutorial. Thanks for taking the time to write it.
If this information isn't already in the 'documents' section for v6.x, you should perhaps consider adding it.

Cheers.

How to remove/disable flag at the bottom?

Jijdaar - June 30, 2008 - 13:45

Thanks for this tutorial, helps a lot.

Any idea how to remove or disable the language flag/selection at the bottom of the page? Using the Language switcher should be enough.

Same problem here. Help

nyirocsaba - December 15, 2008 - 15:17

Same problem here.
Help please!

Remove language links from nodes and use language switcher block

bsimon - December 15, 2008 - 16:17

The easiest way is to add this to your theme's main css file

a.translation-link {display:none;}

see http://drupal.org/node/242408

Thx

nyirocsaba - December 15, 2008 - 19:45

Thank you
div.links {display:none;} it is better, while the space remind there

Can't you just go to:

kingyann - January 28, 2009 - 14:57

Can't you just go to: admin/settings/i18n/translation

and set the Links to Node Translations to NONE?

Drupal 6 version does not offer this

xmacinfo - April 20, 2009 - 20:56

The Drupal 6 version of the internationalization module does not offer this configuration. In fact, your URL does not exist in D6 with the internationalization module.

Hide content translation links

astra - May 13, 2009 - 14:43

Go to: Administer > Site configuration > Language

Select the tab: Multilingual system

Choose the option: Hide content translation links

It's done!

Very helpfull, but it doesnt work with primary links

lionalx - July 6, 2008 - 10:12

When i put the multi-lang. menu in the sidebar it works great, but when i define it as "primary links" in menu>settings all items are visible all the time. I also tried method explained here (http://drupal.org/node/70194, enabling language dependent variables for the menus in setting.php), but it didn't work at all.

I need the "primary links" definition to display it inside the themed header.

any ideas how to solve it?

thx!,
alex

Please, clarify

auris - July 9, 2008 - 14:06

What do you mean by "when i define it as "primary links" in menu>settings"?

Primary links is a special built in menu. If you add two nodes the way is demonstrated in the 2nd option (one menu) the links switch correctly between language selections.

If not, check
a) that you have selected appropriate language for links,
b) and the menu configuration from the blocks (admin/build/block/configure/menu/primary-links), has Language: All languages

I had the same problem and

wimvds - October 14, 2008 - 07:41

I had the same problem and found a solution to this problem. First make sure you have installed i18n and enabled it. Alter the settings.php file in sites/default and add the following snippet (should work in Drupal 5 & 6) :

$conf['i18n_variables'] = array(
        // Site configuration
        'site_name',
        'site_slogan',
        'site_mission',
        'site_footer',
        'anonymous',
        // Node help
        'blog_help',
        'story_help',
        // User configuration
        'user_registration_help',
        'user_mail_welcome_subject',
        'user_mail_welcome_body',
        'user_mail_approval_subject',
        'user_mail_approval_body',
        'user_mail_pass_subject',
        'user_mail_pass_body',
        // Primary and secondary links
        'menu_primary_menu',
        'menu_primary_links_source',
        'menu_secondary_menu',
        'menu_secondary_links_source',   
    );

Then create one menu per language as described in the tutorial above (using one single menu with all languages didn't work for me - due to menu items that don't have Drupal nodes). If you look at the menus settings screen (admin/build/menu/settings) you should see a notification below "Menu containing primary links" and "Menu containing secondary links" that states that they are a multilingual variable (if not something went wrong). Now switch to the first language you want to use (using the language switcher), select the appropriate menu(s) for primary and secondary links and save. Repeat this for every language you wish to use (ie. switch language, select menus, save). Now you should have correct multilanguage primary/secondary links (it worked for me using a single hierarchical menu for both primary/secondary links).

And now you'll probably run into the active class bug (http://drupal.org/node/220559), which really needs to be solved (there's a patch that works in that thread, but it's not recommended to use it, since it changes core files)...

great tutorial, i was using

comunactivo - November 1, 2008 - 22:24

great tutorial, i was using google translation service but now i will try to apply the core translation.

Regards

--
comunactivo

works for me

infolab - November 26, 2008 - 22:37

Thank you wimvds.

to: wimvds

doomed - March 25, 2009 - 03:36

Are you sure this works on Drupal 6?

I know it worked on Drupal 5, but its not working very well on my Drupal 6.10 .

At least the fields i tried, most from Administer / Site Configuration / Site Information (title, footer, etc).

Primary links

JeniferTucker - February 27, 2009 - 13:58

You probably have solved the problem by now, but for those like me looking for tutorials on how to set up a multilanguage site (trying to get categories to work without getting error messages displayed), I too thought I hadn't set up the primary links up right.

It turned out to be that when you are logged in as 'admin', you see all the navigation (in all the languages you have added). If you logout out, or look as a normal user in a separate browser, you will see that they display correctly.

Hope this helps.

I have yet to solve how to add multilanguage categories to nodes. I have a set of categories all set to English. Have yet to work out how to create the alternatives in Spanish and Italian. I thought it would be a matter of clicking on the translation tab, but have managed to not make them a success. If anyone knows of a good tutorial to follow, let me know.

Thanks

Revisal

auris - July 9, 2008 - 13:51

At 2nd option (one menu), step 9 is:

9. Add another item (admin/build/menu-customize/menu-multi-menu/add)

db error

paolorizzi78 - July 25, 2008 - 11:47

Hi auris,

the your explination is very clear and useful, but I found a problem and tyred to see all sort of configurations but still receiving the following error:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN i18n_node i18n ON node.nid = i18n.nid WHERE (i18n.language ='it' OR i1' at line 1 query: LEFT JOIN i18n_node i18n ON node.nid = i18n.nid WHERE (i18n.language ='it' OR i18n.language ='' OR i18n.language IS NULL) LIMIT 0, 5 in D:\wwwroot\drupal-5.8\includes\database.mysql.inc on line 172.

any idea how i could fix it?

thanx a lot,

Paolo

Have you enabled the 'block'

-Anti- - July 27, 2008 - 13:05

Have you enabled the 'block' i18n module, but not the 'strings' i18n module?
Block is dependent on strings, but it wasn't stated as such in an earlier version.
That has now been fixed in the very latest version.
But for earlier versions, it is fixed by enabling the 'strings' module.

Subscribing

ff.tomato - July 26, 2008 - 17:21

Never give up!

Subscribing

cloneofsnake - August 13, 2008 - 17:23

Thanks for solving a mystery for me! I translated a few nodes of contents, but clicking on the languages links on the right only changes the navigation's language, node remains the same.

eg: node/1 is in English, I made a translation and that's node/2. If I click on the "Japanese" language link on the right, it will only bring me to from en/node/1 to ja/node/1.

Thanks for the info about "a flag at the bottom of the page for all the available translations." I don't have a flag but I have a text link "日本語" (Japanese) - clicking on that brings me from en/node/1 to ja/node/2 !!!! Yay...

Oh... what about the comments?

cloneofsnake - August 13, 2008 - 17:48

I just tested... wrote 1st comment from en/node/1... wrote 2nd comment from ja/node/2...

These comments are not shared between the 2 nodes! en/node/1 only shows the 1st comment, and ja/node/2 only shows the 2nd comment.

I think it makes more sense if a pool of translations would share all the comments amongst each other. How can I do it?

I think the 'language

-Anti- - August 13, 2008 - 19:12

I think the 'language sections' module would be your only solution for that at the moment:
http://drupal.org/project/language_sections and co-incidentally, it would also solve the problem you first asked about - having two languages with the same url.

So node/2 would be set to 'neutral language' and contain the content:

=== en ===
This text will only be displayed when English language is selected by the user.
=== jp ===
This text will only be displayed when Japanese language is selected by the user.
=== qq ===
This part will be displayed for all language selections.

Since the different language content is one node, the english and japanese comments will be collated.

Note that this module this can be used in conjunction with the normal language functionality and i18n.
But building Views to create lists of content could get confusing/difficult though.

menu not opened when openening page

myDRU - August 16, 2008 - 08:04

Thanks for the explananation. But I've a question/problem...

I implemented '1st option (multiple menus)' as described above. It works fine, except when I open the home page. At that moment, no menu is shown at all in IE. It is only shown as soon as I click on the language switcher, e.g. if I choose 'English', the English menu is shown. In Mozilla, this problem is not there: the Dutch menu is shown upon opening the page.

I'm working with Drupal 6.3 and since yesterday 6.4.
The problem appears no matter which theme I select (as one could expect).
The problem appears only if I configure "Administer" >> "Site Information" >> "Default Front Page" to a specific node, e.g. "node/1". If I configure "node", the mechanism works fine. What could be the root cause of this problem?

A similar home page problem, and a fix, sort of

spidersilk - September 9, 2008 - 18:08

I'm working on a bilingual (English/French) site, and followed the multiple menus approach in this tutorial, and like the above poster, I've also run into an odd problem with the home page.

What is happening is that if I go to the English home page and click on the "Français" link, I goet the French home page, and everything is fine. However, if I go to any other French page and then click on the "Acceuil" (Home) link in the French menu, I get the content of the English home page, but with French menus -- and most of the items in the menus disappear! Of the five items in the primary links menu, only the first two show, and of the six items in the custom left navigation menu, only the first one shows - all the other items in each of those menus are gone. But if I then click through to any other French page, they come back. It's only on the home page that they disappear.

At first I thought there might be some kind of issue pertaining to URL aliases, since the French page seemed to sometimes be referenced just as example.com/fr and sometimes as example.com/fr/bizassist/basic (bizassist/basic being the URL alias of the English home page) but deleting the URL alias had no effect. The language switcher in the left sidebar references the French home page as fr/bizassist/basic and works; the menus reference it as fr and don't.

Next thing I tried was having the Acceuil link in the French menus go explicitly to bizassist/basic instead of to - this had seemed to work with other URL aliases, for example the "Pour nous joindre" (contact us ) link in the French menu was just to contact, not fr/contact, but when the menu displayed, it added the fr/ automatically. But in the case of bizassist/basic, it didn't, and that item then went to the English page, without even the partial French menus it had before.

Eventually I changed it to just the numeric address of the node -- node/50 -- and finally it worked! The system did add the fr/ in front of the item, and the menus displayed properly in full.

So I've got things working now -- it just seems very odd that the system could not cope with having the French home page referenced either as or by its URL aliases, even though other aliases (contact, faq, etc.) worked fine and were given the fr/ path prefix automatically... And I'm really confused by the way it dropped some of the menu items before - those items did not have any different settings from the ones it kept, as far as I could tell.

Handbook page, pretty please?

zirvap - August 19, 2008 - 16:50

auris, would you consider posting this as a handbook page? It's an extremely useful resource. I just added a link to this forum thread from the Translation, multilanguage content, and internationalization summary page, but it would be even better if this was a child page there.

I'll do it

auris - September 5, 2008 - 11:52

Sorry, I had a long time to look this thread. I posted here to see if it really helps other users. If you (users) believe it must become a handbook, then I will do it as soon as possible.

boring...

dblais - August 21, 2008 - 16:33

Why we need to re-enter the menu title. It can not use the page title? Or better why when can't create the menu when we create the page...

Translating error pages

pressecmadur - August 28, 2008 - 16:19

Thanks for the tutorial. Is there any way to get error pages (404 - not found, 403 - access denied) language dependent ? In admin/settings/error-reporting only one page can be specified for each case.

Tranlation of error pages

auris - September 5, 2008 - 12:18

You must have Path module enabled.

  1. Make a page, write your content and give a name in the URL path settings (e.g. pagenotfound)
  2. Make a translation of the page and give the same name in the URL path settings
  3. Go to the admin/settings/error-reporting and put the url name (pagenotfound) in the corresponding field (at the Default 404 (not found) page: in this example)
  4. Do the same procedure for the access denied page

Please, reply if it helped you.

Great Tutorial but…

errement - September 5, 2008 - 01:32

I have multi-language site (English, Spanish, Arabic & Hebrew) but having problems with Blocks.

When you work with a site in LTR languages (ex. English & Spanish) with "Navigation-User Login-Language switcher" blocks are set to Left Region, now you click on Arabic/Hebrew from Language switcher and everything goes perfectly well translated to that language but i would like also to switch region to right for those mentioned blocks "automatically" when language is changed to RTL.

How would i do that??

I've been searching all around and couldn't find anything to help me!!

I thought on something, maybe it could help, but don't know how to do it. Maybe you can tell me.

What i thought is; while we could set a language (LTR) for the block, that block will only shows on that language page (on left region), but could i duplicate that block and set it to the other language (RTL) to let it shows on right region?!
Is this possible or do you have another solution for me to offer?

For all the rest of blocks i add on my site, i don't have this problem cos i can configure them to show where i want depending on the language i switch to.

Please need help!!!

Thank you so much.

I don't know how relevant this is

Athaclena - September 25, 2008 - 11:17

My left sidebar just displays in the right when I switch to Hebrew - Just try playing with the CSS, direction, text-align and floats.
This way I have the same blocks in the same region... the difference is where the region actually displays.

I hope this helps.

2nd menu option does not work

Elfendahl - September 7, 2008 - 12:25

Hi,

Thank you for a wonderful guide! However, I am unable to make the 2nd menu option work. I create a new menu, create new menu items with different languages set, but still all menu items in all languages are displayed, regardless of language specified by user. It's very strange, as if the option specified in the language box is ignored.

Can you give me any clues as to why this is?

Thanks!

Works for me but discovered new bug!

errement - September 7, 2008 - 23:42

@Elfendahl,

auris's 2nd option (one menu) explanation is working fine, i have just tried it and it works perfectly for me. Maybe something you're not doing right, try it again, & explain more.

Make sure you have enabled the menu block under Blocks, and have set the menu item's Parent item to your just created menu.

I have noticed that you get all languages as you say —menu items with different languages— ONLY if you set their Parent item as "Primary links" and are navigating "…/admin/build/menu-customize/primary-links" so maybe this is a bug, anyone noticed this bug?

Now it works!

Elfendahl - September 8, 2008 - 05:01

Thanks errement, I got it working now! The problem was that I did it a bit sloppy the first time and just linked the menu item to an arbitrary page. But this does not necessarily work. The page the menu item links to has to be a drupal page of the same language as the menu item, which it wasn't in my case. But now it is and now it works! :)

Great tutorial

t-ars - September 8, 2008 - 14:53

I've been looking for this tutorial for a while. Most of them out there focus on Drupal 4 or 5.

The next step, which makes it complete for me, is path aliasing. You can add the same alias for each translation of a node if you supply the correct language (otherwise you will get an error, telling you that the alias already exists). Instead of having links to "node/1" and "fr/node/2", this will result in "home" and "fr/home".

Two things I'm still trying to figure out. If anyone has an idea:

1) Always force a language prefix. I'd like all links to specify the prefix ("en/home" instead of "home" - if English is the default language).
2) As "Jijdaar" points out, I'd also like to be able to remove the language selection at the bottom of each node (without using dirty theme hacks).

Easy

errement - September 8, 2008 - 16:08

@t-ars,

Two things I'm still trying to figure out. If anyone has an idea:

1) Always force a language prefix. I'd like all links to specify the prefix ("en/home" instead of "home" - if English is the default language).
2) As "Jijdaar" points out, I'd also like to be able to remove the language selection at the bottom of each node (without using dirty theme hacks).

As for the first:
-Go "…/admin/settings/language/edit/en" and enter "en" for "Path prefix" and click "Save language"
-Go "…/admin/settings/language/configure" and choose "Path prefix with language fallback." as "Language negotiation" and click "Save settings"
-Now go "…/admin/settings/site-information" and you'll find that the home page displays content from this relative URL: "http://www.example.com/en"
-This way, ALL what you visit under english language will begin with "/en" and other languages "/…the_language_prefix_here…"
-Maybe you should consider visiting "…/admin/settings/i18n" to select "Content selection mode" as you wish.

Finally for the second; i think you want to configure it as you do with the Language icons under "…/admin/settings/language/configure/icons" by adding or not, icons to "Node links" but i think this is not possible —as far as i know, maybe someone out there have tricks w/o hacking files—.

Thanks a lot for the hint on

t-ars - September 10, 2008 - 11:41

Thanks a lot for the hint on the first one, I had "Path prefix only" as "Language negotiation", which doesn't prepend the language prefix for the default language. Now it works.

I'll try to find a clean solution for the second issue.

Dirty workaround

t-ars - September 10, 2008 - 13:26

For the second issue: The cleanest solution would be an extra checkbox in the translation settings that just allows you to choose if you want the links or not (translation.module => function translation_link() could check if it needs to generate anything).

But since we're not allowed to go in there ;-) I have a dirty hack solution:

In template.php of your theme add the following function

<?php
function mytheme_links($links, $attributes = array('class' => 'links'))
{
   
$firstlink = reset($links);
    if (
$firstlink && $firstlink['attributes'] && $firstlink['attributes']['class'] == 'translation-link')
    {
        return
'';
    }
    else
    {
        return
theme_links($links, $attributes);
    }
}
?>

It detects if translation links are themed and returns the empty string, otherwise the default theme function is called. Not quite what I'm looking for, but it does the trick for the time being.

language selection still appears

yudi_set - September 26, 2008 - 08:31

Hi,

I'm a newbie.
Thanks for sharing.

I have a fresh install of Drupal site (in English).
And then I added 2 more languages.
I'm also need to do the same as you.

So, I copied the mytheme_links function to the template.php file in /themes/garland/ folder (I'm using the standard Garland theme).
But it does not work.
The language selection still appears on the bottom.

Maybe there's some setting that I need to configure?

Please help.
Thank you.

"mytheme" should be replaced

t-ars - September 29, 2008 - 09:09

"mytheme" should be replaced by the name of your theme.

So, in case of Garland, the function-name should read: garland_links

Hope this helps.

it works !

yudi_set - September 30, 2008 - 03:15

It works!

After I cleaned the cache, the language selection does not appear anymore on the bottom of the node.
Really appreciate your help.

Thanks a lot!

This is exactly what I was

markgardner - September 30, 2008 - 17:07

This is exactly what I was looking to do http://drupal.org/node/299647 thanks to yudi_set pointing me here.

Unfortunately I can't get it to work. Despite copying the function to template.php in my themes folder and renaming the the function accordingly, even after deleting temporary files it still displays links under the nodes.

Any more ideas?

Mark

Clean workaround

libernux - October 21, 2008 - 17:12

Just add the following to the end of the css-file:

ul.links li, ul.inline li {display: none}

Tested and working on theme Garland

Remove language switcher

auris - October 25, 2008 - 07:33

To remove the language switcher for each node, try the following hint: http://groups.drupal.org/node/16148

Administrating a multi-language site

mansspams - September 8, 2008 - 23:37

How do I assign user a premission to edit only one language in D6 multi-language site?

really nice

lennyaspen - September 14, 2008 - 19:57

i should say man
really nice tutorial
thx

One node - many langauges

denverdataman - September 15, 2008 - 21:58

Is there a way to have one node that has 2 bodies (one for English one for French). I am familiar with CCK so I see how I could maybe do it that way but I think there has got to be a better way.

Thanks,
Steve

Steve Kessler skessler[at]denverdataman.com
Denver DataMan - http://www.denverdataman.com

Add one more textfield for

mansspams - September 16, 2008 - 16:06

Add one more textfield for French. How much better can it be? Do you have any special needs for functionality?

Then I guess I would put the

denverdataman - September 16, 2008 - 16:47

Then I guess I would put the code on node.tpl.php for sorting out what language the site is in for which CCK field to show. My concern is that is a lot of logic to put in the theme.

Thanks,
Steve

Steve Kessler skessler[at]denverdataman.com
Denver DataMan - http://www.denverdataman.com

> Is there a way to have one

-Anti- - September 17, 2008 - 21:19

> Is there a way to have one node that has 2 bodies (one for English one for French)

Check out the 'language sections' module:
http://drupal.org/project/language_sections

You have one body, but the filter displays only part of it,
dependent on the current language selection.

Maybe the modules Language

astra - May 13, 2009 - 12:05

Maybe the modules Language Section can help you. See project:

http://drupal.org/project/language_sections

Menu Translation 3rd Option.

rfranquet - October 11, 2008 - 01:04

To internationalize the menu, there are a 3rd option.
It changes the content automatically when you switch the language .

- Active the path module to have URL Aliases

1. Add a new menu (admin/buid/menu/menu/add)
2. Give the menu name and Save.
3.Add an item (admin/build/menu/item/add)
4. In the Language combo box you don't have to choose a language!
5. Give the title title in English
6. Give the path for the English page (node/1) and Save.
7. Translate the menu title with Localization (admin/settings/locale/string/search)

=====================================================
*** Two languages ***
1=English 2=Spanish

(alias English => Spanish)
8. Add URL Aliases (admin/build/path/add)
9. Give Existing system path node/1 give Alias node/2 and Save

(alias Spanish => English)
10. Add URL Aliases (admin/build/path/add)
11. Give Existing system path es/node/2 give Alias es/node/1 and Save

=====================================================
*** Three languages ***
1=English 2=Spanish 3=German

(alias English => Spanish)
8. Add URL Aliases (admin/build/path/add)
9. Give Existing system path node/1 give Alias node/2 and Save

(alias English => German)
10. Add URL Aliases (admin/build/path/add)
11. Give Existing system path node/1 give Alias node/3 and Save

(alias Spanish=> English)
12. Add URL Aliases (admin/build/path/add)
13. Give Existing system path es/node/2 give Alias es/node/1 and Save

(alias Spanish=> German)
14. Add URL Aliases (admin/build/path/add)
15. Give Existing system path es/node/2 give Alias es/node/3 and Save

(alias German=> English)
16. Add URL Aliases (admin/build/path/add)
17. Give Existing system path de/node/3 give Alias de/node/1 and Save

(alias German=> Spanish)
18. Add URL Aliases (admin/build/path/add)
19. Give Existing system path de/node/3 give Alias de/node/2 and Save

How to disable language flag

zweipunktnull - October 4, 2008 - 13:56

Now, for every page you have created there should be a flag at the bottom of the page for all the available translations. Choosing that flag should display the appropriate page. The same happens if you choose language from the Language switcher.

However, I don't want to have these flags at the end of each page/article, because I have already the language switcher in place. How/where can I switch off these flags?

br

Peter

Easy to do, just one thing

Benxie - October 12, 2008 - 12:23

All work well, exempt for one thing, the primary links or said Menu, if I activiate them in Thems, they can't change for each language( Though i specify each menu entry with a specific language), just show up all. If I activiate them in block( Put to header), they just show up vertically.
Till now, I just haven't an idea how to resove this problem, only can let them there in show up all lanugage links in the header.

A+

GRboss - October 16, 2008 - 12:44

This tutorial gets an A+

if your in ubercart you need drupal 5 and i am unable to properl

lmfisher100 - October 22, 2008 - 13:49

if your in ubercart you need drupal 5 and i am unable to properly configure languages... Any sugestions?

Troubleshooting

gaele - October 27, 2008 - 18:19

One of the things that can go wrong:

Go to
.../admin/settings/language/
edit each enabled language and make sure it has a path prefix. Drupal won't complain if this field is empty, but switching languages won't work correctly.

(It took me a couple of hours before I found out my non-default language had an empty path prefix ;-}

language negotiation based on domain name

dps - November 1, 2008 - 18:54

When you edit the language at admin/settings/language/edit/en
and you are negotiating langauge based on domain name, don't forget the http:// prefix.
I know it is written there in the field help, but I missed it and things behaved very strange.

http://2tell.org

Does the length of the

-Anti- - November 1, 2008 - 23:56

Does the length of the comments on this thread perhaps indicated that the multi-language implementation in drupal is really very inadequate? It's become so complex and convoluted; it really is a mess. Not that this is the fault of the developers who implemented it - I'm sure they did the best job they could.

But this is what you get when you try to simply tack, as an after-thought, multi-language support onto a system which wasn't designed for multiple languages in the first instance. IMO if Drupal is ever going to be able to claim that it is truly multilingual, at some point the current implementation is going to have to be completely scrapped and rewritten much deeper into the core.

I have no idea how the

cloneofsnake - November 3, 2008 - 12:18

I have no idea how the Drupal's inner workings are handling multi-language at the moment, but I agree that i18n's multiple language nodes is not the right way to do things. If a node content is basically just being localized, then they all should share the same comments.

I see that you are always pushing the Language Sections module, but do you think that is the "correct" way? I was wary of using that module b'coz I don't know how well it will upgrade... (I'm a database guy and whether you mix multiple "fields" into one field, that's a problem.)

I guess creating new CCK fields will be a better way? So like if i18n instead of creating a new node when you click translate, it makes copies of all the CCK fields under a different language, that will be a way between the current multi nodes i18n module, and the text field parsing Language Sections module.

What are your suggestions?

> I see that you are always

-Anti- - November 3, 2008 - 17:57

> I see that you are always pushing the Language Sections module
> If a node content is basically just being localized, then they all should share the same comments.

Um, nope. I don't even currently use it. But if you want two languages available at one url, or for multi-lingual comments to be displayed under one node, then it's the only solution available, which is why I have mentioned it in a couple of threads. But I don't think that should quite be how the main multi-language support should be implemented...

The LSections module keeps the translation in the same database CELL as the original, which is just as bad as creating a whole new node for it. So I think the core functionality should keep the translation in the same database ROW as the node, so that there is only one NID shared between the main language and the translations, and that the comments are shared, but then there'd be some freedom within queries to treat the translation cell as its own separate entity (except of course, its NID and comments).

> i18n's multiple language nodes is not the right way to do things

I agree, but it's not i18n which is doing it though; it is the core language functionality which works that way. And the reason it probably works that way is that drupal wasn't originally built with multi-language in mind and this confined the language developers. Which is what I was 'complaining' about. Multi-language has obviously been implemented as a half-arsed afterthought rather than a serious consideration from the start. And until language functionality has been rewritten from the bottom up (which will break all existing sites), the implementation will just keep getting more and more convoluted and unstable.

Ok thanks

micro_vn - November 5, 2008 - 04:28

Getting error messaage whenever I install a language package

StefanScottAlexx - November 16, 2008 - 16:27

In order to install additional languages in Drupal 6.6, I'm following the steps mentioned here:

http://drupal.org/node/203318

where Gábor Hojtsy stated:

1. Download langauge package
2. Extract to Drupal's root directory, where Drupal is already exctracted
3. Enjoy that all files fall into place, such as modules/system/translations/*.po

By the way, this also agrees with the info here: http://11heavens.com/building-powerful-and-robust-websites-with-drupal-6...

But I've tried this using Drupal 6.6, and I'm getting an error message.

Here's what I did:

1. First I made sure there are NO languages (other than English) currently installed, because the site:

http://11heavens.com/building-powerful-and-robust-websites-with-drupal-6...

says:

Get the translation tar ball (*.tar.gz file) from http://drupal.org/project/Translations, then move this file to your web root (in the same folder as index.php), then extract the file. Every extracted .po file (as there are many, many) ends up where it's supposed to be. The translation package has a tree structure, that of your Drupal installation. Then and only then, you add the language (going to admin/settings/language/add). At that point, the importing of all .po files is done automatically for you by Drupal.

2a. I downloaded the language package (eg, Brazilian Portuguese):

http://ftp.drupal.org/files/projects/pt-br-6.x-1.0-rc5.tar.gz

from here:

http://drupal.org/project/translations

2b. Then I uploaded this to my public_html directory (which in my case is the same thing as my Drupal installation directory - because I'm using a free, shared web hosting provider which doesn't give me access to the file .htaccess which would be needed to redirect http://mydomain.com/mydrual to http://mydomain.com).

2c. Then I used cPanel File Manager to extract the compressed tarball (eg, pt-br-6.x-1.0-rc5.tar.gz) to the Drupal installation directory. (By the way, earlier I was doing this wrong - I was extracting into a subdirectory within the Drupal directory, eg ../public_html/pt-br/ or ../public_html/pt-br-6.x-1.0-rc5.tar - because I didn't realize that extracting the tarball would actually extract each file into its proper subdirectory, due to the fact that the tarball directory structure is the same as the Drupal directory structure).

2d. I then repeated the above steps for another language (eg, Spanish), so as to be able to test if the error message (shown below in the 'code' box) is reproducible for these two language packages (and it is - meaning that this is probably not a problem with the language packages themselves.

I believe that the .po files have been extracted to the proper locations. For example, if I use cPanel File Manager to go to this directory...

/public_html/modules/block/translations

...it contains the following two files...

modules-block.es.po
modules-block.pt-br.po

... for Portuguese (Brazilian) and Spanish, before I perform my step 3 below.

3. Then I went to:

http://mydomain.com/admin/settings/language/add

and added the language (eg, Portuguese (Brazilian)).

and I got the following error message:

An error occurred. /?id=&op=do <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head> <title>mydomain | mydomain</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" /> <link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?V" /> <link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?V" /> <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?V" /> <link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?V" /> <link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?V" /> <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/style.css?V" /> <link type="text/css" rel="stylesheet" media="print" href="/themes/garland/print.css?V" /> <!--[if lt IE 7]> <link type="text/css" rel="stylesheet" media="all" href="/themes/garland/fix-ie.css" /> <![endif]--> </head> <body class="sidebar-left"> <!-- Layout --> <div id="header-region" class="clear-block"></div> <div id="wrapper"> <div id="container" class="clear-block"> <div id="header"> <div id="logo-floater"> <h1><a href="/" title="mydomain"><img src="/themes/garland/logo.png" alt="mydomain" id="logo" /><span>mydomain</span></a></h1> </div> </div> <!-- /header --> <div id="sidebar-left" class="sidebar"> <div id="block-user-1" class="clear-block block block-user"> <h2>admin</h2> <div class="content"><ul class="menu"><li class="leaf first"><a href="/user/1">My account</a></li> <li class="collapsed"><a href="/node/add">Create content</a></li> <li class="collapsed"><a href="/admin">Administer</a></li> <li class="leaf last"><a href="/logout">Log out</a></li> </ul></div> </div> </div> <div id="center"><div id="squeeze"><div class="right-corner"><div class="left-corner"> <div class="messages status"> The language <em>Portuguese, Brazil</em> has been created and can now be used. More information is available on the <a href="/admin/help/locale">help screen</a>.</div> <div class="clear-block"> <div id="first-time"><h1 class="title">Welcome to your new Drupal website!</h1><p>Please follow these steps to set up and start using your website:</p><ol><li><strong>Configure your website</strong> Once logged in, visit the <a href="/admin">administration section</a>, where you can <a href="/admin/settings">customize and configure</a> all aspects of your website.</li><li><strong>Enable additional functionality</strong> Next, visit the <a href="/admin/build/modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="http://drupal.org/project/modules">Drupal modules download section</a>.</li><li><strong>Customize your website design</strong> To change the "look and feel" of your website, visit the <a href="/admin/build/themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="http://drupal.org/project/themes">Drupal themes download section</a>.</li><li><strong>Start posting content</strong> Finally, you can <a href="/node/add">create content</a> for your website. This message will disappear once you have promoted a post to the front page.</li></ol><p>For more information, please refer to the <a href="/admin/help">help section</a>, or the <a href="http://drupal.org/handbooks">online Drupal handbooks</a>. You may also post at the <a href="http://drupal.org/forum">Drupal forum</a>, or view the wide range of <a href="http://drupal.org/support">other support options</a> available.</p></div> </div> <div id="footer">hosted by <a href="http://vlexo.com" target="_blank">vlexo.com</a><div id="block-system-0" class="clear-block block block-system"> <div class="content"><a href="http://drupal.org"><img src="/misc/powered-blue-80x15.png" alt="Powered by Drupal, an open source content management system" title="Powered by Drupal, an open source content management system" width="80" height="15" /></a></div> </div> </div> </div></div></div></div> <!-- /.left-corner, /.right-corner, /#squeeze, /#center --> </div> <!-- /container --> </div> <!-- /layout --> </body> </html>

This same error also occurred when trying to add Spanish and German. I've also tested this on two different shared web hosting providers, and it occurs at both of them (using Drupal 6.6).

When I go to http://mydomain.com/admin/build/translate, all the percentages are still zero:

Language Built-in interface Blocks Content type Menu Profile Taxonomy
English (built-in) n/a n/a n/a n/a n/a n/a
German 0/1003 (0%) 0/0 (0%) 0/5 (0%) 0/0 (0%) 0/0 (0%) 0/0 (0%)
Portuguese, Brazil 0/1003 (0%) 0/0 (0%) 0/5 (0%) 0/0 (0%) 0/0 (0%) 0/0 (0%)
Spanish 0/1003 (0%) 0/0 (0%) 0/5 (0%) 0/0 (0%) 0/0 (0%) 0/0 (0%)

By the way, as an alternative I also tried going here:

http://mydomain.com/admin/settings/language/configure

before doing my step 3, and selecting either 'Path prefix only' or 'Path prefix with language fallback' (instead of the default selection 'None') to see if selecting either of these helped avoid the error message generated in my step 3 - but I still got the error message.

After the error message is displayed, the language does appear in the list of installed languages here:

http://mydomain.com/admin/settings/language

And if I go here:

http://mydomain.com/admin/build/block

and add a 'Language Switcher' block to my page layout, it does show up with the right language.

And clicking on a non-default language in the Language Switcher on my home page does create the correct URL, eg:

http://mydomain.com/pt-br
http://mydomain.com/es
http://mydomain.com/de

However, all admin pages are still displayed in English, and when I go to http://mydomain.com/admin/build/translate (see second 'code' block above), all the percentages are still zero

Any suggestions would be most welcome!

updating languages on a multisite

fabius - November 17, 2008 - 23:24

When I read this tutorial I had already created a second language (in ignorance) before loading a language file. So after I uploaded the language files and tried to Add the language again, it was missing from the list on the Languages page. Furthermore there is no explicit method for updating a language. This is what I did to get my language files recognised:

- Make sure the second language is not set as default. A delete option will appear.
- Delete the language. Drupal will give you dire warnings about what will happen but the language files will still be there.
- Add the language again. Drupal will look for the files, including those meant for modules, etc.
- Edit any content node you may have created in the second language and you will find its language has been set as "Neutral". Change this appropriately.

Language files may change often so Drupal needs a way of updating these.

fabius

Yes - can someone help us out

Regw - January 21, 2009 - 21:03

We're a bunch of 6.x users with this issue... see comments on http://drupal.org/node/335039

Please update this excellent page

bsimon - December 12, 2008 - 07:04

This is a very helpful page, but there's now important information in the comments which isn't easy to find. It should be added to the article (I would do this myself, but normal Drupal.org users can't edit the page).

I suggest adding these items to the menu creation section:

1 a link to this post: http://drupal.org/node/275705#comment-1038558 and a short summary of it - maybe that summary also needs a link to http://drupal.org/node/313293 to provide more detail on string translation

2 a link to this page: http://drupal.org/node/313302

...and 'different' is spelled wrong at the beginning... :)

How do I set it up so

Sonjaaa - February 4, 2009 - 03:48

How do I set it up so certain users can translate comment to language X and certain other users have the right to translate content to language Y, etc.?

How to update translation when original content is update?

KaAsk - February 7, 2009 - 20:47

I create a little site with about ten articles which regularly change. They need to be translated in some languages.

So I'm looking for a module which permits translators (and visitors) to see what sentences or paragraphs have changed in source articles.

Diff module is helpful, but isn't integrated with I18n modules. And it may be useful to view how old is the translated node compared with the source node.

ICanLocalize Translator does incremental translation

icanlocalize - February 20, 2009 - 15:57

This is one of the features of ICanLocalize Translator:
http://drupal.org/project/icanlocalize

It doesn't do source level DIFF. Instead, it extracts the text from the HTML and does proper text level DIFF.

The translator will see the entire document but will only edit the texts that are modified (or added).

Multilingual domains & it8n module

binhcan - March 12, 2009 - 17:55

This is a great guide mate. Thanks very much. Without it I was just lost and couldn't make my site truly multilingual.

Just a note though: We need the it8n module because it has more feature then the core "Content Translation".

Also a note: To use the domain we need to use the whole domain name with the prefix "http://" otherwise it won't work. For example, my main site is jewell.vn the domain for language would be "http://en.jewell.vn" for English and "http://vi.jewell.vn" for Vietnamese.

I want to give this note because I spend hours trying to put "en" in the text box and it didn't work. I hope you guys won't make the same mistake and waste your times.

Remember to install the it8n module otherwise you also waste time like I did too... tried to translate the menu and taxonomy.

Cheers,
Binh

Suggest site for managing i18n of a site

f3arless - March 19, 2009 - 12:27

See: http://www.translateapp.eu/

it's a web app for managing internazionalization of a site, application, portal, ecc, ecc

if you have a suggest, please contact me from the contact form of translateApp

Bye!

If stories are not translated, will the menus translate them?

parka - March 24, 2009 - 06:36

Thanks for the tutorial, it's helpful.

I'm not sure of how to translate all the the stories on my site. Do I have to first translate the stories manually using edit before the menus can show the translated stories?

E.g.
I've a menu link to German translation. When I click the menu link, only the English stories with German translation are translated. English without German translation are still in English.

How can I achieve something like Google Translate? My old way of translating my website is to point users to Google Translate, Google will then translate the requested page while it's loading the page.

Automatic machine

-Anti- - March 24, 2009 - 10:58

Automatic machine translations are barely readable.
However, if that's what you want then there is probably a module to integrate
one of the translation services into your site.

This thread is about manual translation of content by human admins/authors.

Option 2 (one menu) for multilanguage site

JeniferTucker - March 30, 2009 - 15:14

I'd like to try option 2, but having followed steps 1-3, am stuck on finding where this is:

admin/build/menu-customize/menu-multi-menu/add

Is there a module I'm missing?

Have tried option 1, but it's getting a bit messy having lots of separate menus, so this option seems sensible.

No, there isn't any missing

auris - April 2, 2009 - 15:07

No, there isn't any missing module.

The path (admin/build/menu-customize/menu-multi-menu/add) is not a url on it's own. You should append it on the url of your site. E.g. http://example.com/admin/build/menu-customize/menu-multi-menu/add

Or you can just go to Administer > Site building > Menus choose your menu and click the tab Add item.

GREAT WORK !!!

nooby - April 23, 2009 - 10:48

With Your tutorial I could start... but can't see the consistent ending.

Issues I've met:
1. Primary links localization problem - no clean way - try to add translated 'Home' link to \node or or taxonomy-generated node.

2. (case: mixed language, single menus, other than NAV) : In case You need to add either external or non-drupal link - the link appears twice.

Edit:
3. SOLVED Possibly not related - is there a way to make RSS feeds in a secondary language (100% translated, but how to use ?) or should I use Taxonomy and terms?
Answer:

Use taxonomy term in one language, but translate it. Add term in primary language to content page and it will be translaed in to what you set as translation for this term.

Anyone had these issues?

if various themes installed you can get an error message

gmateos - May 12, 2009 - 23:13

thank you for the tutorial and the module...is great and a must for me.
I installed the module and got an error: " Argument #2 is not an array.....theme.inc...line 930"...well...i investigated a little bit and discovered the problem: theme.inc is searching for a variable like "theme_xxxxx_settings" and for some of my themes installed and enabled, this variable was not setup.
Why? because I never pressed the button "save" on theme configuration page. That's all.
So, i went to each theme enabled, saved the configuration without changing nothing...and everything is ok now.

Is it necessary to make English as the default language

bnadem - May 26, 2009 - 14:48

Thank you very much for this useful howto ;)
Just a question : Is it necessary to make English as the default language for having multilingual support to work properly ?
Thanks for taking time to reply ;)

Default language problem

hstrindb - June 11, 2009 - 07:22

Thank you for great work!

I want Swedish to be the default language. And in the tutorial I read:

"2. Make sure English is the default language"

- why is that important? There seem to a problem:
If I define Swedish as the default language the language switcher doesn't work properly. What to do?

Best regards
Henrik

That was the way I first

auris - June 21, 2009 - 15:49

That was the way I first managed to enable both languages and work with.

The 1st step can be changed in order to have any of your languages as default.
The guide says:

  1. Go to the Languages page (admin/settings/language)
    • Add all the languages you downloaded and extracted (admin/settings/language/add)
    • Choose Configure
    • In the Language negotiation choose Path prefix only and save settings
  2. Make sure English is the default language
  3. Go to the blocks (admin/build/block)
  4. In the Disabled area choose a Region for the Language switcher
  5. Choose Save blocks

Change the steps to this:

  1. Go to the Languages page (admin/settings/language)
    • Add all the languages you downloaded and extracted (admin/settings/language/add)
    • Choose Configure
    • In the Language negotiation choose Path prefix with language fallback and save settings
  2. For every available languages choose edit under the Operations column. In the Path prefix: field insert language prefix, e.g. en for English, fr for France etc.
  3. Go to the blocks (admin/build/block)
  4. Choose your preferred language as default
  5. In the Disabled area choose a Region for the Language switcher
  6. Choose Save blocks

The deference is that when a visitor cames to your site, he will see the content with the default language. After that, choosing a page, e.g. node/1 he will get the prefix always for the selected language. So, if selected language is English, the path will be en/node/1 and for France fr/node/1.
Following the previous steps (English default and path prefix only settings), there is no prefix in the url for the default language.

Also, you can change the settings so you have no prefix for your default language, and have one for any other. To do that set Path prefix for every available language and set default your own.

Choose what is best for you!

Problem when opening contact form page in 2nd language

albert.pratama - June 18, 2009 - 09:45

Hi all,

I have tried both options presented there. With any option of those two, all went well until I open the contact form in 2nd language (I made a bilingual website, English - French, with English is the default language). Opening the contact form in French makes all menus not shown. This happened with both of options. Opening contact form in English doesn't bring the same problem.

Does anybody have any ideas what went wrong on this?

Btw, I use Drupal 6.11 with Internationalization module 6.x-1.0.
Thanks in advance.

Regards,
Albert

SLOGAN Translations, how?

Alex.G - June 22, 2009 - 12:51

Thanks for great article, but still can't figure out how can i add slogan translations?
Using only two languages at the moment.

Thank you

I know have the Language

ncarson - June 29, 2009 - 18:04

I know have the Language Switcher English/french button on the right side. I also have the English or French button on the bottom of my main page. The issue is this. If I am in the Englsih main page and click on french at the botto of the screen ... the page will translate to french. If I then select english at the bottom of the page it will change to the english page. Which is great.

but the issue is this.

When I first go to my test site it defaults to english, which is ok for now BUT if I use the Language Switcher button on the RIGHT hand side of the screen and click french the main page does not change to french. But if I use the small french button on the bottom of the main page it changes to french.

It should be noted in the IE address bar when I select french in the side language switcher bar the url changes to
www.mysite.com/drupal6/fr but the mainpage is still english but if I click the french button at the bottom of the mainpage the url changes to www.mysite.com/drupal6/fr/node/5 and the main page is now french

How can I get the Langauge switcher on the right on side of the screen working ?

I look under administer / site configuation and my default frontpage is www.mysite.com/drupal6/en/node/1 which is english. While in adminster / site configuartion if I click the side language switcer to french the default fronatpage changes to www.mysite.com/drupal6/fr/node/1 Could the problem be that my french page is /node/5 and not /node/1 ?
If so how do I fix this ?

Thank you very much
Neil

Ok I got it working. The

ncarson - June 30, 2009 - 11:58

Ok I got it working. The below site/url help me figure it out.

http://drupal-translation.com/node/37

Thank you
Neil

 
 

Drupal is a registered trademark of Dries Buytaert.