I have been playing with drupal for the last few days and in particular with the internationalization features. After a few test runs, I found that:
1. Translating aliases didn't do what I expected to do. In particular, creating localized aliases such as en/home and de/start wasn't working correctly, as the translation switcher would point to en/home and de/home instead of using the localized path. This has been fixed by this patch: http://drupal.org/node/67814

2. I didn't like the way menu titles were translated through the string table because the workflow of that is very cumbersome. Also, if the english title changes, all the translations would have to be redone.
That's why I created the attached patch as a proof of concept. It has the following improvements:
a) translate menu title AND menu description, not just the title
b) it adds a new page admin/menuTranslate which offers a grid-based editor for the translations

This is implemented by adding a new database table, i18n_menu, which has translations of menu titles and descriptions for each language.
The menuTranslate page is generating an html from and rendering it as a themed table. I tried to do it through the drupal forms api, but after a few hours I decided to do it by hand (I'm still quite new to drupal).

Installation:
- put the attached i18nmenu.module into modules\i18n\contrib, replacing the existing one
- run i18nmenu.mysql against your database to create the new table. You may need to edit the sql statement if you use table prefixes.
- optionally include the supplied css fragment in your theme's css

Remaining tasks:
- this is my first attempt at some drupal development, so it may not follow best practices along the lines of style or performance
- only mysql support so far. The table creation should be done in an install hook and perhaps support other databases.
- the translation editor page can potentially get very big, which may not work with some themes. Also, it could perhaps use paging and the forms api.

In any case, I hope that some people may find this useful.

CommentFileSizeAuthor
#1 i18nmenu.module.patch4.97 KBBodo Maass
i18nmenu.zip2.65 KBBodo Maass

Comments

Bodo Maass’s picture

StatusFileSize
new4.97 KB

Here is the same patch in unified diff format.

oweowe’s picture

Can this work with Navigation menu? If not, is there option to translate the navigation menu? Thanks!

Bodo Maass’s picture

It works for me with any kind of menu, including the navigation menu, so yes.

Bodo Maass’s picture

This patch is not compatible with the latest revision of the i18n module from 5. August 2006. I'll try to rework it against the latest version of the codebase. I will also remove the extra table and use the existing localization system so that this has less impact on existing systems.

Bodo Maass’s picture

Ok, I tested this a bit more. It works fine with 4.7.3 after all, but it does not work with the navigation menu in its current form. I presume that is because it only translates menu items that have the flag MENU_CREATED_BY_ADMIN, so maybe that could be changed easily. However, the navigation menu is already handled by the locale, so I see no need for that, and in fact adding the navigation menu would clutter the custom menu translation table.

oweowe’s picture

Would you please tell me how to make it work in Drupal 4.7.3 for the navgation menu? In my navigation menu, I have added some custom menu items (such as items created by the view module) which I don't know how to do the translation.
Your kind assistance is truly appreciated!

Bodo Maass’s picture

Hi oweowe,
I don't really know if and how it would work with the navigation menu. My patch just improves the existing translation path for custom menus. This is dependend of the type of the menu item, so I would study that more. At your place, I would start with removing the check for MENU_CREATED_BY_ADMIN and see what happens.
Good luck!

oweowe’s picture

Thanks for your tip. After removing MENU_CREATED_BY_ADMIN, it works nicely!

nobis’s picture

For me, installing this patch breaks the menu options when creating content. When I create a page I cannot choose a 'parent menu' in which to add an item for the new page. The combo-box does not have any options. If I still enter a name in the menu 'Title' field, a whole new menu gets created. Any suggestions?

jose reyero’s picture

Status: Needs review » Closed (won't fix)

This version is not supported anymore. No new features for it.