Hi,
I'm not sure if i messed up something or if this is standard behaviour.
I have a quite fresh install of drupal 4.7 and latest i18n cvs (15th of may).
With my 4.6 install with i18n, i used to be able to translate the text of a menu item through the locale module.
On the latest version i can't anymore...The locale module doesn't find the menu item string...
Also the link where the menu item refers to, doesn't get translated to the proper language, even though the Translation block links do. E.g. 'en/about' should become 'nl/over' when i click the dutch flag, but it becomes 'nl/about' instead.
It used to work like i want on the 4.6 version, but i applied some patches made my New Oceans to get it like that...
I though the i18n_menu module used to take care of all of this, but now this seems integrated with the other modules.
Maybe something's missing?
Comments
Comment #1
Marc Bijl commentedWith a fresh install of i18n (without all "patches" I've used before in 4.6.6), the translation of menu items using locale module is not any kind of problem for me...
However, it's not possible yet to let a menu item point to the right node, depending on the language. This is assumed to be done by the menu module, which is on it's way:
- http://drupal.org/node/62822
The translation block has been fixed last weekend, so that should be fine too:
- http://drupal.org/node/62799
Resume:
- Menu translation: should be ok
- Menu functionality: on it's way
- Translation block: should be ok
Comment #2
jose reyero commentedI've added the i18nmenu.module which seems to work without any update :-)
About the menu items linking to the right nodes, try these url aliases:
en/mynode -> node/1
es/mynode -> node/2
Comment #3
Marc Bijl commentedHmm. Don't get it...
To explain, I have defined these nodes:
(node id 1, english, url alias idea)
(node id 2, dutch, url alias idee)
(node id 17, english, url alias en-US/idea)
(node id 18, dutch, url alias nl/contact)
I have also defined these English primary links in the menu system:
(menu id 84, path node/1)
(menu id 69, path node/17)
To get these menu items translated, I have used localization:
So: when I'm browsing the English site (prefix en-US in address bar), all is fine. However, when I start browsing the Dutch site (prefix nl in address bar), the menu items are Dutch indeed, but they all point to the English nodes... Because I have nowhere assigned the primary links to a second node, namely the Dutch tranlated one.
Where and how should I define that one primary link can point to either an English node, or a Dutch node, depending on the language?
Comment #4
Marc Bijl commentedMoreover, browsing the site in English (language prefix en-US in address bar)...
... menu item / primary link idea points to example.com/en-US/idea (prefix ok, node ok)
... menu item / primary link contact points to example.com/en-US/contact (prefix ok, node ok)
But, browsing the site in Dutch (language prefix nl in address bar)...
... menu item / primary link idee points to example.com/nl/idea (prefix ok, node not ok)
... menu item / primary link contact points to example.com/en-US/contact (prefix not ok, node not ok)
A bit of inconsequent behaviour; probably I'm doing something wrong, but haven't found out what...
Hope this all makes a bit sense; if you're interested in my workflow in 4.6.6, just let me know.
Comment #5
Marc Bijl commentedWhat is table i18n_variable for? It's empty here... Can that be something wrong?
Comment #6
jose reyero commentedThe table i18n_variable is for language dependent variables
Have you updated your settings file according to the new INSTALL.txt instructions?
Comment #7
Marc Bijl commentedHi Jose,
Yes, I have updated the settings file: /sites/default/settings.php ;-)
Hmm... You know what, this is how I used to administer primary links in 4.6.6; may be it makes clear how I'm thinking and what way(s) I'm trying to achieve the same in 4.7
Created nodes
Created a hierarchical menu
Created primary links
/en-US/admin/themes/settings/
.
Here the English primary links showed up, so here I defined English link texts, English urls and English descriptions: "idea", "idea" and "the idea of this site"
/nl/admin/themes/settings/
.
Here the Dutch primary links showed up, so here I defined Dutch link texts, Dutch urls and Dutch descriptions: "idee", "idee" and "het idee van deze site"
/en-US/admin/themes/settings/
.
Here the English primary links showed up, so here I defined English link texts, English urls and English descriptions: "contact", "en-US/contact" and "get in touch"
/nl/admin/themes/settings/
.
Here the Dutch primary links showed up, so here I defined Dutch link texts, Dutch urls and Dutch descriptions: "contact", "nl/contact" and "neem contact op"
Resume: as you can see, the theme setting page used to be the area where I defined primary links and I changed the language prefix in the address bar to switch between administration languages and so switch between administering English respectively Dutch primary links.
However: now that primary links are not part of theme settings anymore, I don't know where to go and tell Drupal/i18n that one primary link (e.g. "idea") can point to two pages (e.g. "idea" or "idee" depending on the interface language.
I know in the menu system it's possible to create both an English primary link (pointing to the url alias of the English node) and a Dutch primary link (pointing to the url alias of the Dutch node), but then I get these two primary links side by side in the menu :\
Another option at the node's editing page might be assigning menu items, but here happens the same: if I assign an English menu item at the English node's editing page, and assign a Dutch menu item at the Dutch node's editing page, then I get these two menu items side by side in the menu as well...
Hope this makes clear how I used to work in 4.6.6 and why I don't know where to go in 4.7
Cheers ;-)
Marc
Comment #8
Marc Bijl commentedAbout my 4.6.6 workflow: forgot to mention that -of course- I assigned node 1 and 2, as well as 17 and 18, as being translations of each other.
Comment #9
Marc Bijl commentedHmm. Small, little step further...
$conf['i18n_variables'] =...as I managed to define a dutch footer in the dutch administration page, and an english one in the english administration page. They show up in the site correctly (:However, this workflow (administering in two different languages, that is, with two different language prefixes in the address bar) does not work for primary links in the menu system...
Does anyone know: where do I have to make the difference between dutch and english primary links, including their own paths to their own nodes?
Comment #10
jorditr commentedHi Marc.
It's easy to have the primary links (and secondary working). Just add to the settings.php page inside the directory site/defaults at the end of the page
That means that this time when you go to the page en/admin/settings those elements will be saved as "english" but when you go to the page nl/admin/settings (which will be visualitzed on dutch throgh the l10n module) all those fields will be saved properly. Hopefully the i18n.module translation routines will do the rest... That means that this page save it's own information on every language version as localized general config parameters.
Also consider that you see translated the variables of the config page that you add to the list on the settings.php page but not the others. Obviously you don't have to do nothing on your template page, just let it call primary and secondary links the usual way, you don't need to customize anything.
Comment #11
Marc Bijl commentedThanks for the info Jordi, but I know about the principle of the i18n_variables as I managed to get things like footer and slogan translated: http://drupal.org/node/63691#comment-99452
BTW
I defined
$conf['i18n_variables'] = array( ... );instead of$i18n_variables = array( ... );But now it's about primary links, and those are not at the settings page, but at the menu page....
I get them translated through localization, but I don't get them working. That is, a Dutch primary link must point to the Dutch node = Dutch url alias, whereas the English translation must point to the English node = English url alias (different!).
At the menu page I have one set primary links, defined in English (en-US). If I switch the administration's language to Dutch, change the primary link "idea" into "idee", change the url alias, and save the whole thing, the the English menu item is gone (even if I switch the language for the administration page back to English...).
The other way around I have the same problems.
So it seems like a primary link as menu item can only be saved in one language. This is confirmed in the database, as footer, slogan etc get their own two rows in table i18n_variable (on row for nl and one row for en-US), whereas I still didn't manage to get two rows created for menu items / primary links.
Another option I've been thinking about, is defining the menu through the menu settings at the node editing page, so I can define a Dutch menu item + url alias for a Dutch node, and an English menu item + url alias for an English node. But if I do that, I get two menu items defined in the primary link menu, and they show up next to each other in the menu at the site...
So I'm wondering: where do you define primary links / menu items in both languages, including their own url aliases, which are different?
Hope you can help, as this is driving me crazy :\
Cheers,
Marc
BTW
In 4.6.6 I used to define the primary links at the theme settings page. In 4.7.0 these primary links are gone, and became part of the menu system. Therefore I have the slightest feeling we're not talking about primary links anymore, but about menu items. So that may be these need their own i18n_variables?
Comment #12
jorditr commentedWops, wops, wops, primary and secondary links are not definied on any menu area (I have no idea how you can have defined primary menu links on any menu area...) BUT on the theme config area! :-D
Something like http://www.yoursite.com/en/admin/themes/settings/your_active_theme page.
All the themes that use phptemplates (and for sanity I always use phptemplates for my themes) define primary and secondary links through a form: one column for the entry, the second for the link, on an area called "Engine-specific settings". How do you do that? Well, the happy point here (if you haven't notice) is that this page works the same way than the config one, the parameters are saved depending on your current active language just because you have registered the variable on the setting.php file. Does my explanation makes sense? If not don't hesitate to ask me again :-)
Comment #13
Marc Bijl commentedThat sounds how it needs to be done in 4.6.6: the way how I used to do as described here:
- http://drupal.org/node/63691#comment-99219
However, since I'm running 4.7.0, the primary links at the theme settings pages are gone, and they moved to the menu system. The basic configuration pages here at Drupal say about that:
You can read some more information about that here:
- http://drupal.org/node/63601
- http://www.drupalecommerce.com/node/653
And there's an interesting webcast here:
- http://www.lullabot.com/videocast/drupal-4.7-menu-system
So, I would love if things were like in 4.6.6 (and like you just described), but here in my administration it doesn't look like in 4.6.6 anymore. At the the theme settings pages I see just these areas:
> Global settings
-- Toggle display
-- Display post information on
-- Logo image settings
-- Shortcut icon settings
> Theme specific settings
-- Toggle display
-- Logo image settings
-- Shortcut icon settings
And indeed, in 4.6.6 there was an area called "Engine-specific settings", but it's gone :\
Comment #14
Marc Bijl commentedJust watched the webcast at http://www.lullabot.com/videocast/drupal-4.7-menu-system It makes very clear what differences there are in defining primary links between 4.6 and 4.7
Comment #15
luigi12 commentedUnfortunately I cannot reconstruct how I got there, but the whole i18n system screwed up at some point and stopped to work in a meaningful matter. I ended up in deleting all posts and cleaning up the database. I'll try to replicate the sistuation as far as possible. Just a heads up ...
Comment #16
jorditr commentedI have no updated to 4.7 so I have no idea. I'm having a very powerful system working on 4.6 with lots of small customization here and there. Uhmm, I don't know maybe I'll wait to upgrade until i18n goes core ;-)
Comment #17
svendecabooterI got it working now...
Seems the latest cvs release comes with i18n_menu.module now, which wasn't there in the version i tested when reporting this issue.
Thanks for the help guys. The module is really getting neat.. Keep up the good work!
Comment #18
Marc Bijl commentedSuggestion
-----------
After having contact with topic starter xeniox, I suggest to change:
- Category
- Title
Actually, I allready did ;-)
Reason
-------
It seems like translating menu items isn't the problem anymore; if I'm right, anyone who posted in this topic knows how to do it. Is that correct?
Okay then, next step.
The question now seems to be (at least for me): how to get menu items, especially primary links, working? That is, pointing to the right nodes?
In 4.6.6 it used to be done by defining primary links (including url aliases) in the theme settings page, while the admin was set to the concerning language. Then switch admin language, etc, etc.
However, in 4.7.0 the primary links cannot be defined seperately (for each language) anymore at the theme settings pages; instead they became part of the menu system.
So, does anyone know how to achieve that primary link 1 (language A) points to node 1 (language A), whereas the translated version of that primary link points to node 2 (language B)?
Comment #19
boriso commentedOne temporary solution is to use multilingual blocks.
Comment #20
boriso commentedOk, actually the multilingual blocks work fine with menus in general (you create one menu for each language), but indeed it is not capable of handling the primary links. Sorry if I was misleading.
/boris
Comment #21
Marc Bijl commentedIssue solved. Will try and write some explanation later today.
Comment #22
Marc Bijl commentedHere's a quick 'n short explanation about creating multi lingual primary links (will create some better documentation soon). In this example I will work with Custom English (code/prefix en-US) and custom Dutch (code/prefix nl).
That's basically it! Have been writing these instructions a bit in a hurry, but I think this all should do the trick.
Comment #23
3B commentedharder to explain rather than doing ...
many many many many many many many thanks you both!
ciao
Comment #24
3B commentedBTW ... i found very usefull to include
'menu_parent_items',
in the $conf['i18n_....
just my 0.02€
Comment #25
3B commentedBTW (2) ... i'm kludging arount to avoid primary links to appear on top ... in favour of a more preferred "block" menu ... now, still looking how to fix layout (setting leafs/collapsed and indent ...) if any idea pls post
actually i've build a php block with this code
but i do not want "links" style ...
Comment #26
3B commentedsometime we (me) loose control and look too far from our noosepoint !!!
print menu_tree(variable_get('menu_primary_menu', 0)) ;
as PHP content of a block !!!
(amazing Drupal!!! thanks again!!!)
Comment #27
klance commentedIt seems like and unbelievably major pain to have as many menus as you have languages. In fact, if you use the path "mypage" as your menu item's path, instead of "en/mypage" or "nl/mypage" i18n will prepend the locale automatically, making the links point to "en/mypage" and "nl/mypage" when you click on them. If you go into localization and translate your menu items' titles so that they appear in the correct language, they actually work! The titles change and the links change when you change the language. Except for one thing--they don't expand. For flat menus, this is as far as you need to go. For hierarchical ones, you'll have trouble. I hacked menu.inc and got submenus to expand (see http://drupal.org/node/65960) and they work perfectly with breadcrumbs, taxonomy_access, etc. The only thing I have left to fix is the fact that tabs don't appear on regular pages when you view them, but I am currently running one menu for all languages. I work with big menus, and when I can flip back and forth between translations of pages and forum postings, it just seems a bit clunky to have to surf through several menus every time I need to make a change to one link, and hope that they all continue to remain consistent over time. The key to getting this working is matching url aliases like "en/mypage" or "nl/mypage" with menu paths like "mypage" in the menu, without breaking other things. Check it out and let me know what you think.
Comment #28
mandclu commentedPrepending the URL aliases with the language does indeed seem to work. It is a pain that this is necessary, since I know some users of the system will forget to do this, however.
There is another issue this approach seems to have raised, however. Now, when I go into the translations tab, it doesn't link up the translation anymore, next to the language in question, it has the "create translation" link again. I even tried using the "select node" feature to re-link it, but it wouldn't take.
So this is an important fix, but it does have some problems.
Comment #29
mandclu commentedOne more thing I've noticed now... If I'm looking at an English item, say:
en/about
The links in the language block will point to the translated version, such as:
hu/about
clicking on that only shows me the Hungarian version of the content if I have specified the URL alias for the translation as "hu/about", even though this has the issues cited in my previous post.
What I just noticed, however, is that the language block links no longer function properly. While I'm looking at "hu/about", they link to the node by number, no longer by the alias. So, I'll see something like:
en/node/74
And of course, if I click on that, I see the Hungarian content in the English framework, which is bad. Any idea how to get that working?
Comment #30
davemybes commentedSurge_martin, I have been struggling with the same problem for a while now. I finally figured out something. In the block list there are two language blocks. On is "Language switcher" and the other is "Tranlations". Use the language switcher only on the front page. Then use the translation block on all other pages, EXCEPT the front page. Now when I hover over the various languages on a page, the correct url's are shown eg. en/competition and fr/concours.
I hope this helps you and others.
Comment #31
mandclu commentedThanks for sharing your experience, incrn8. On my site, however, the two blocks seem to work in an identical manner.
One difference I can see is that it had been my intent to use the same url alias for each language, such as:
en/about
hu/about
de/about
...and so on. Any thoughts on why this would seem to be a critical difference?
Comment #32
Bodo Maass commentedI wanted to use links in their proper language, such as
en/home
de/start
This is not possible with the release from 03/06/2006. However, I found this pending patch: http://drupal.org/node/67814, which solved this problem for me.
Comment #33
texas-bronius commentedsurge_martin: you might glean some good info from this growing "i18n for dummies" thread in which we're consolidating tips on basic multilingual setup, i18n menus, and switching between languages. Probably this posting isn't really a bug fix issue, so the thread might facillitate discussion a little better..?
-cheers
Comment #34
asiafan commentedI made my primary link menu multilangual without making two of it...
I noticed that aliases or links without a language tag find their destination automatically like the forum link goes to en/forum and hu/forum according to what language I am in. So then I made a new menu item in primary links with a link "about" (no language tag). Then I made two aliases:
/node/35 = en/about (node 35 is my about page in english)
/node/36 = hu/about
And then it works. I dont have an alias for "about" but when using the link from the menu in any language it puts that tag in front of it so then it goes to the right node.
And of course I have primary links set to be language dependent in settings.php.
Other stuff like polls, forums, moviereviews and thing like that I didnt have to set, they change the content with the language by default (using the translation block, not the language-switcher).
Comment #35
asiafan commentedthe only disadvantage of the method I explained is that aliases (the alias word after en/ ) have to be the same in both languages
Comment #36
ledelboy commentedJust a quick addition. I am working with a left navigation theme, and New Oceans' recipe didn't seem to work at all. I had a Primary Links menu for English and a Primarios for Spanish, but I could only see the English links.
I am probably in a dumb mood, 'cause it took me too long to realize that if your primary links work as blocks, yo've got to treat them as blocks. I configured the Primary Links to show only on en/* pages and Primarios to show only on es/* pages. Works like a charm. I just wish more drupallers were as detailed in their cookboks.
Well, maybe it doesn't, since switching languages on the fly keeps giving me inconsistent results. But I really don't care. The one thing I've learned after three multilingual sites, is that a link to the alternate language(s) that go(es) to the other language home page is less confusing for my users than giving them the chance to jump from language to language anywhere in the site.
Comment #37
(not verified) commented