OK, I'm new to Drupal you see...
I'm trying to create a multilingual site using the i18n module.
I downloaded the module and both finnish and swedish languages. I set up Swedish as the primary and finnish as the secondary language. When I go to the site it's in Swedish now -so far so good.

I can see the languages are enabled like so in the URL (example):
?q=sv/admin -displays the site interface in swedish
?q=fi/admin -displays the site interface in finnish

I read the howto and readme in the i18n folder and on the web but could not figure the following out...

My questions are:
* How do I get the flags showing on the page so that the user can choose his language? I'm looking for a functionality exactly like on this site where you can click the flags http://www.reyero.net/. Ihave primary and secondary links disabled. Do I need to enable these or something?

* Do I create 2 different menus for the different languages or what? I mean, I can make a new page, select the language and make it visible under my navigation-menu. But then it is still visible under both languages. I'm a bit lost on this one.

//Rob

PS. If you don't know the ansver, can you recommend any good tutorials on setting up a multilingual site?

Comments

Marc Bijl’s picture

The i18n module isn't updated to 4.7.0 yet, so there's some testing needed to get things done.

Regarding your questions:

(1) To get the flags like Jose got them on his site, you will need to do some coding (it's customized). However, you can use two standard blocks for this: translation (switches the language of the whole site) or language switcher (switches the language of the node only). So you'll need to enable these blocks (administer > blocks), put them in the region of your choice (e.g. right sidebar or something) and eventually configure them.

(2) To get primary links pointing to the right nodes... I don't know. This used to be set at the theme settings pages in 4.6.6, where one could change the admin language to define primary links in each language. However, in 4.7.0 primary links became part of the menu system. The items can be translated by using localization (administer > localization), so that should not be a problem, but it's not clear to me where the paths to the different nodes (one for each language) need to be specified. One would expect in the node editing page or something, as there's a menu settings area, however, that will result in each menu item being displayed twice: once for each language. There's a discussion going on here:

- http://drupal.org/node/63691

Hope it makes some things clear. If you want to run a stable version, you better stick to 4.6.6.

___________________
discover new oceans
lose sight of the shore

robthedog’s picture

Thank you New Oceans.
With language switcher I now got the flags visible so the user can click on either to switch the language of the site. This actually works almost the way I want it to -> the interface language of the site switches with the language chosen. So far so good... Again

So, I have everything working on the multilingual site except one thing I just dont get yet:
How do I logically set up the 2 different menus for the different languages? This is what I want to do:

Lets say I want a very simple site, 3 pages.
1 Home
2 Products
3 News

Swedish is the primary language, OK. So the site shows the Swedish menu (this works fine now):
1 Hem
2 Produkter
3 Nyheter

Finnish user clicks on finnish flag -> Site interface is now finnish, but -> the menu should say:
1 Etusivu
2 Tuotteet
3 Uutiset

So my question this time is:
How do I logically set up these localized menus in Drupal?

There are so many alternatives in Drupal that are hard to distinguish between for the non-pro. (For instance: do I use blocks, multilingual metablocks, modules, menus, nodes or some localisation setting to accomplish what I want...)

I promise to write some sort of “for dummies” howto once I get this up and running, there are probably many others that have the same problem. There doesn’t seem to bee any good documentation on setting up multilingual sites as of now.

Marc Bijl’s picture

As I wrote in my previous post:

To get primary links pointing to the right nodes... I don't know.

As primary links are menus in 4.7.0 (one of the things that radically changed with the upgrade from 4.6.0 to 4.7.0 is that primary links have been converted from theme settings to menu items), I'm struggling with this issue myself...

Hopefully, I'll find the way to go pretty soon ;-)

___________________
discover new oceans
lose sight of the shore

lisa’s picture

If you are using primary links follow New Oceans steps here:

http://drupal.org/node/63691#comment-102236

If you are talking about creating your own menu block, here is what I did:

Say you've created 3 pages in Swedish
Hem node/1
Produkter node/2
Nyheter node/3

Make sure you've got the localization module enabled and have added and enabled the languages you want.
Make sure you have i18n module installed and enabled. Enable translation, i18n, i18nblocks, and i18nmenu modules.

Go to administer/menus

  1. Click add menu tab and create a menu called Swedish Menu (or whatever you want to call it).
  2. Then click add menu item under your newly created menu.
  3. Enter Hem for the Title and node/1 for the Path.
  4. Make sure Parent item is Swedish Menu.
  5. Repeat steps 2-4 to add menu items for Produkter and Nyheter.

Then repeat the steps above to create menus and menu items for English and Finnish menus.

Then go to administer/blocks and click on add multilingual block tab. Under block description, give the block a name (like Menu). Select a block to be displayed for each language. In the dropdown choices you should see Swedish Menu(menu) and the other menus that you just created. Click save.

Then enable the multilingual block called Menu that you just created. Select the placement and configure as you want. And you should be good to go.

I am using a multilingual block to have menus in three languages. It works together with the Translation block that came with i18n. When I click on my language preference in the Translation block, my menu (and all site content) changes to the desired language.

I'm using Drupal 4.7, the cvs version of i18n and the box_grey theme (which uses the phptemplate engine).

texas-bronius’s picture

Thanks, lisa, for the great how-to!

I had some trouble with the post by New Ocean that lisa mentioned. I'm on 4.7.2 with the i18n module pack for 4.7, but I didn't immediately see "english" (or any language choices) on creating/edit content. I found that it must first be enabled on each content type (Admin>Settings>ContentTypes>[pick one]>>Configure, then select Enable under Multilingual support for each content type). Then, when you go to create new content, that content's language choice will show in a dropdown.

--
..happiness is point and click..

--
http://drupaltees.com
80s themed Drupal T-Shirts

trantt’s picture

Lisa,

I received the \modules\i18n\contrib\i18nblocks.module on line 79 warning message when editing the multilingual block. Are you having the same problem?

Thanks

lisa’s picture

Trantt,

No, I don't remember seeing that warning when I created my multilingual block for menus. Just now I went to administer->blocks and selected configure next to my multilingual menu block. I checked the settings and then clicked save. No error message. Sorry I don't know what to suggest as I'm not seeing an error message.

trantt’s picture

Lisa,

I think this problem doesn't exist when installing the internationalize module from scratch (will run into problem when converting internationalize from 4.6x to 4.7x)

Anyway, here is the link to this issue http://drupal.org/node/69589 .

Thanks

lisa’s picture

Hi Trantt,

Glad you got it figured out. I was wondering if it was upgrade-related since you said you had upgraded from 4.6.8 to 4.7. But in the issue post you referenced asiafan said he started with 4.7 and also got the warning message.

I had built from scratch starting with 4.7. Then I upgraded to 4.7.1 and then 4.7.2 but I never saw the warning you all are experiencing.

While I never got the warning you did, I have seen the problem mentioned in that issue post that once you create a multilingual block you don't have the option to delete it.

All I could figure to do was to disable the block if I didn't want to use it.

Has anyone else found a solution for this yet?

trantt’s picture

Lisa,

I tried every possible ways (disabled i18n modules, dropped all i18n related tables and then converted to 4.72) I could but the problem is still there. I was able to remove those existing i18n blocks (delete those i18n records from blocks, system, variable tables and disable/enable those theme default) but it didn't help much. I wonder there is a way to debug a php program. Even though I don't know any thing about php and as well as drupal architecture but I'm desperate enough to try out anything.

Once again Lisa, thanks for your help

trantt’s picture

Lisa,

According to google search, the warning message that i'm running into was due to an emptied array. To fix this problem, we have to make sure the array object is not emptied before we are doing anything with it. Here what I did

1. Locate i18nblocks.module line 79 (foreach($module_blocks as $delta => $block)
2. Before this line, I added if (count($module_blocks) > 0) {

Once I added the above syntax, the warning message went away. Thanks to google search, it provided me both the solution and the php syntax...

Once again Lisa, thank you for spending sometime to look at it for me.

Trantt

trantt’s picture

Sorry for the wrong post. I've no idea how to remove it

millo’s picture

I've followed New Oceans instructions on http://drupal.org/node/63691#comment-102236 but have been unable to get that to work. I can't figure out what it is that's wrong but I'm pretty new to Drupal anyway.

The impression I get is that creating your own menu within a multilingual block (the way you explain in http://drupal.org/node/65182#comment-125220) is easier to do than trying to get the existing primary menu to work with multilingual (the way New Oceans explains it in http://drupal.org/node/63691#comment-102236) but I don't know if creating your own menu within a multilingual block has disadvantages over the other way which is using the already installed primary links.

Does primary links have inherent advantages/features which would not be available to a created menu within a multilingual block?

Basically, I just wanted to know if there is any advantage to using the primary links menu (and attempting to get something like what New Oceans suggests for translation and url aliasing) over just creating your own menu within a multilingual menu block?

Any help / Guidance appreciated.

Fidelis’s picture

The author of the module just wrote me - i18n for Drupal 4.7 is coming soon to a theater near you... :-)

patrick

Marc Bijl’s picture

However, there seem to be quite a lot of issues to be answered:
- http://drupal.org/project/issues/i18n

Where I'm especially interested in this one:
- http://drupal.org/node/63691

Can and would you like to share what Jose told about releasing i18n for 4.7.0?

___________________
discover new oceans
lose sight of the shore

Fidelis’s picture

As a principle, I prefer not to share specific info sent to me by email in a forum; but I'm sure that Jose would be pleased to answer you - have you alerted him via his contact form? That's how I initally got in touch with him.

Cheers

patrick
G2TT | IMN | Slaw

Marc Bijl’s picture

Yep. I've used the contact page before. But in times like these, when all contrib module maintainers are scampering to get their things done, I try to use the contact form as less as possible. I know they must be receiving tons of e-mails like "when will the 4.7 version be ready?" and I don't want to stress them even more with another mail like that...

Things are ready, when they are ready - know what I mean ;-)

Besides, Jose wrote that he wants to use this topic to keep us informed, so I assume he will.

However, as his last post there is from nearly two weeks ago, I thought you might have some interesting, additional info.

Anyway, no worries. I'll spend the nights in a sleeping bag in front of the theatre ;-)

___________________
discover new oceans
lose sight of the shore

Fidelis’s picture

LOL

That makes two of us!! ;-)

patrick
G2TT | IMN | Slaw

Anonymous’s picture

I managed to successfully install the i18n module, with the translation module, etc...
It works fine, but I have one problem:

1. My interface is English, Spanish, and German
2. I have no problems to have translations in these three languages, but how do I tell the i18n modules that I want to be able to have more than those 3 languages, just for translations, not for menues and all other Drupal stuff (as I might have the occasional text in other languages, but won't bother with setting up all menues in other languages...)?

Any help? I swa something about doing something in the config file, but it didn't tell me what to do there?

Andreas

texas-bronius’s picture

ok, "i18n for dummies" is too good a heading to start another of the same content.. Without turning this into yet another i18n support line, I'd like to extend robthedog's list of two questions with a logical third:

* Using the Internationalization module pack, is there a really nice way to map 1:1 node correspondences? I really like the idea that "about" is the same as both "en/about" and "es/about" but shows different content. Closest I've seen is described in lisa's post above, and I can't imagine that Jose (who has the original flip back and forth between languages) has made translation entries for ALL the text in his various nodes.

As an experiment, I tried setting each node's url alias/path to "en/about" and "es/about" respectively: that works like a charm! But clicking the magical switch-languages flags doesn't know to automatically change only the "en" with the "es". Thoughts?

--
http://drupaltees.com
80s themed Drupal T-Shirts

texas-bronius’s picture

I got it I got it!
Based on the reply in a thread dealing with switching between languages with the flags, a difference between the "language switcher" vs. "translations" blocks was pointed out. Here are the simple steps that what worked for me:
Verify/Set Settings:
* enable block "switch language": configure to show only on <front>
* enable block "translations": configure to show everywhere but <front>
Create Content:
* create content node in english
** set english as its language (see above)
** set "URL path settings" to "en/about"
* create "mirror" node in spanish
** set spanish as its language
** set URL path to "es/about"
* edit either the mirror or the original (Incidentally, after submitting the spanish translation page, you land nicely at the edit page for the mirror/spanish page)
** click on the Translation tab then "Select Node"
** choose the node that is the translation of the current page (the english page created earlier) and click Save. This defines a "bidrectional" link between the two pages.
* Test it and jump for joy: click the View tab, then click the language translation block flag for the other language, and you get the "translated" node!

A note on links: I set url paths to the full en/about and es/about for english/spanish respectively. However, your links within the node contents (menus, too?.. I dunno yet), should point to the path alias minus language (i.e. both "en/about" and "es/about" should be "about").. Links are relative to the current path/current language! This is awesome. Uno trabajo bueno, Jose!

--
http://drupaltees.com
80s themed Drupal T-Shirts

texas-bronius’s picture

Question: If links within content are not full paths ("en/about") but rather just "about", when these nodes appear on the front page, the text within is not "translated". What I would like to do is make the default front page be either "es" or "en" (just like when you click the language-switch/translate flags at the top from the home page). However, experimenting with the front_page module always results in an infinite 302 redirect loop! Further, I'd like to set that default path based on the current language selected...

[Update]
I'm getting closer: something, perhaps i18n?, provides "frontpage" which refers to the front page. This, in conjunction with "front_page" provided by the front_page.module, gives most of the desired effect. I'm left with only a tacky "en/frontpage" and "es/frontpage" which is effective but not as nice as nothing.. really close though! Also, it seems to go to system default lanuage (not current language).

How I got here:
* install and enable front_page module which allows one to override the default Drupal front page
* admin>settings>front_page
** set FrontPage Settings for Anonymous Users:
*** select "redirect"
*** value "frontpage" (no quotes..)
** set FrontPage Settings for Auth Users:
*** select "same" (same as Anon users above)
** leave override HOME links default (unchecked, blank)
** Activate Frontpage Settings
*** value "front_page" (no quotes..)

Hovering the HOME and header logo links will give your default main url, and clicking it will arrive there and redirect to "en/frontpage". All links within text (as discussed above) now work!

Any ideas on popping off the last two steps (clean w/o "frontpage" in the url and frontpage'ing to the current language)? Even Jose's website defaults to english, but he doesn't have "en/frontpage". Adding a url alias from "frontpage" => "home" makes it a little nicer..

--
http://drupaltees.com
80s themed Drupal T-Shirts

mfh’s picture

me too I get an infinite redirect loop

in spite of many trials (i18n on/of, localizer on/of, switch locale on URL/content/locale param...)
I still don't know how to fix it.

basically, it's the page that should show up as default ("front" ?) page (I don't know if this is important).
I have translated it, now both contents show up if one clicks on the site logo(e.g.),
but one of them gives an infinite redirect loop if I want to view it or edit it.
(both have an URL alias).
I don' know if the redirect loop is due to the URL alias, due to the en/ prefix which is automatically attached (which is extremely confusing : this prefix should be usable in links to do the locale switching but then immediately be deleted from the REQUEST_URL !) or due to locale switching (since the prefix remains even if one wants to switch language...).

this seems heavily buggy...

texas-bronius’s picture

MFH- check my last step above setting Frontpage to "node" rather than "front_page" as stated. I'm checking my config (haven't touched it in some time!), and this is how mine is setup. If this works for you, please report back, and I'll update my post if I can.

--
..happiness is point and click..

--
http://drupaltees.com
80s themed Drupal T-Shirts

pulpzebra’s picture

By just enabling language switcher and translations blocks the same way you did, I get the same result with no need to define url paths for the translated node content. Maybe this is just for better SEO ?

texas-bronius’s picture

this is just for better SEO?
SEO definitely.. attractiveness?, that's subjective (but still yes). It also makes sense to enable clean URLs to allow folks to share urls directly into your site ("deep URLs") for a couple reasons (they're cleaner, I think they don't wrap in emails..)

I believe, however, that path aliases and clean URLs are comparing uncomparables: cleanURLs just take away the querystring format "?q=en/about" part and allow "en/about". Whether or not you have aliases will determine if you can say "about" or "node/12" or what have you.

--
..happiness is point and click..

--
http://drupaltees.com
80s themed Drupal T-Shirts

texas-bronius’s picture

For lack of better placement, thought I'd toss out this little gem:
To get the breadcrumb trail default item "Home" text to translate (to "Inicio" in Español), I added an automated translation entry. To manually add translations to .pot files, this worked for me:

  1. Save a copy of /modules/i18n/po/i18n-es.po (or the file corresponding to your language) to your local machine
  2. Add the following to the end of the file:
    msgid "Home"
    msgstr "Inicio"
  3. Save the file (locally)
  4. Go to your site, Admin>>Localization, click Import
  5. Browse for your file locally, select the destination language, select "replace existing, new ones are added" and click Import
  6. Drupal i18n should respond with a count of translation updates and additions.

The .po or .POT files feed the automatic translator: It's my understanding that anything drupal-generated passes through this auto-translator. Note that the .po file is not a "live file"-- you have to import it to see changes take effect.

--
..happiness is point and click..

--
http://drupaltees.com
80s themed Drupal T-Shirts

jose_drupal’s picture

Do you know of a way to have the english version be available in /about and have the spanish version available at /es/about? In the URL path settings I'm not able to set both pages with the "about" value. So, I try putting es/about for the spanish version and when i visit the page I get /es/es/about...

seanberto’s picture

I've searched the forum for this one, but haven't seen what I need. I would like to create custom translation links in my nav bar, as Jose has done on Rejero.net. I'm pretty new at theming, but think that I could make it work if someone won't mind steering me in the right direction.

Thanks in advance for the help!
Sean

Sean Larkin

pulpzebra’s picture

I have a website (www.testimedici.com) that should display content in both English and Italian. It's 4.7.2 and the updated version of i18n

Following is how I rendered the translation for the menu:

1) in settings.php $conf['i18n_variables'] I've put 'phptemplate_primary_links' as one of the values; (there're no secondary links in the site)
2) I've created a menu with all items in English;
3) Then, under administer/localization/manage strings I added the italian translation for each menu item.

Is this the proper way to achieve this?

Marc Bijl’s picture

Yes, it is the proper way if you have URL's like this:

- ?q=en/translations
- ?q=it/translations

No (at least as far as I know), it is not the proper way if you have URL's like this:

- ?q=en/translations
- ?q=it/traducioni

Then you better make two separate menus for primary links, one for each language. For information:
- http://drupal.org/node/63691#comment-102236

Succes!

___________________
discover new oceans
lose sight of the shore

pulpzebra’s picture

Thanks for your help!

greathonor’s picture

Is it really works for "menu"s?
Or it's still in development....

macm’s picture

I am using i18n.

I am trying translate localization name (admin/locale) with "manage strings"

So I found strings and translate

English
French
Portuguese
To English pages

and
Anglais
Français
Portugais
To french pages

and
Ingles
Francês
Português
to Portuguese pages

But I cant see in my block of "Translations" this translation.

I just have flag with static localization name.

If default is English, French, Portuguese and I click in flag of portuguese
I Still see English, French, Portuguese unless Ingles, Francês, Português.

So I dont know if the problem is in i18n or drupal core.

If someone have solution. Please help me.

akoymakoydpl’s picture

I think this is the correct topic for me to go to:

i've searched for hours on an existing solution but I dont seem to find anything close.

My problem is my URL contains parameters: mydomain.com?var1=xxxx&var2=xxxx

when I click a language (flag) on the language switcher it just goes to :

mydomain.com/es or mydomain.com/en

it omits the parameters on the current page. Is there anyway I could change the way the links is generated so that I could include the existing parameters?

Actually I already coded the generation of the link But the problem is values such as "?" "&" are being replaced with %3f etc. And therefore when link is generated it looks something like:

mydomain.com%3fvar1=xxxxx

which now leads to a page not found page.

I really hope someone can help on this one.