According to this previous issue ( http://drupal.org/node/356375 ), it sounds like this should be fixed in the recommended version 6.x-1.7

I am having exactly the same issue where I create a new menu and enable the block, the menu title is not translatable.

I have the following selections for the created block:

    Language:
  • All languages
  • Arabic
  • English
  • French

When I create any other block (custom) I get the following options and the block title is translatable.

    Language:
  • All languages
  • All languages (Translatable)
  • Arabic
  • English
  • French

The previous issue did indicate this is to allow a custom block title to be translated and doesn't specifically say a menu block title is supported as translatable. If this isn't intended to be a proper fix for a menu block what is the best way to make a menu block title translatable?

Comments

bsnodgrass’s picture

Title: Refresh Issue?: Patch to make menu block title translation work » Reopen Issue?: Patch to make menu block title translation work
bsnodgrass’s picture

According to http://drupal.org/node/356375#comment-3010092 Jose commented he had posted a patch to correct this.

I am using 6.x-1.7 and have also checked out 6.x-dev from 13-Oct-2010 neither seems to have correct the posted issue from 356375.

Please advise! Thanks

jose reyero’s picture

This other was a related but different issue.

Blocks created by modules (not custom blocks) are in principle not translatable. For menu blocks we translate the menu tree though.

Custom block titles are supposed to be translatable only if the block has no language (All languages). The All languages (Translatable) is about translating the block content too.

bsnodgrass’s picture

Jose,

Thanks for the response. I think I understand that the behavior is correct as it is. My menu items are able to be translated (menu tree) but the title of the block cannot be.

So the question is how do I work around this issue? There are a lot of menus in this system with lots of nested menu items in the tree. I do need to translate the menu titles or adapt for this limitation.

Do you have a suggestion short of creating a menu for each language?

Thanks, Bob

bsnodgrass’s picture

Just wanted to update about what I ended up doing... these work-arounds probably aren't the most elegant ways to approach life, but they worked. Hopefully these fixes will stand the test of time. I looked around for some good documentation and found a number of comments but nothing which really gave me the missing piece I needed.

Jose's post #3 confirmed that the title itself is not translatable, [not being a programmer I still don't quite understand why]. So went back to look into more options. This is a rather complicated site and I wanted to make sure I was approaching it in the least time consuming manner with the fewest adjustments. I settled in on using the method described in http://drupal.org/node/356375#comment-1792318.

My solution:

I have about 5 menus built and exposed as blocks visible by role. I was going to create block template files for each, however the fix turned out to be very simple and works. I simply opened the block.tpl.php file, wrapped the existing code $block->subject with the t() function. I must have had all the pieces in place and that was the missing link!

Before:

  <?php if ($block->subject): ?>
    <h2 class="title"><?php print $block->subject; ?></h2>
  <?php endif; ?>

After:

  <?php if ($block->subject): ?>
    <h2 class="title"><?php print t($block->subject); ?></h2>
  <?php endif; ?>

I'm wondering if this will be sustainable or by taking the shortcut of simply editing the main block.tpl.php file instead of created new files for each block will that create problems later?

I've posted a addition to a documentation FAQ page about this. I also had a number of other issues which are now solved and working. which looks like an appropriate place to post some more details on this and other things I had to do to make it all work. At some point I will document these in documentation. if anyone wants more information or wants to share some other ideas I'm sure it would be a help to me and others who are looking for solutions.

wranvaud’s picture

Issue tags: +menu title translation

Fantastic!!! This worked for me just the way it should. I wonder why it still feels like a workaround...
After adding the t() function you have to go to "translate interface" and chose the menu title you want to translate.
The only problem is that you have to add it to every theme that you want to use (but it's so easy it's ok).

Wonder why this seamless translation of menu titles is not default...
Thanks again for the solution!!!!!!!!!

liquidcms’s picture

this doesn't work for me.. even though i can verify that i am picking up the right block title and i have wrapped the subject in t().. when i go to translate interface this block title does not show on my list. doing a refresh of all items doesn't help.

liquidcms’s picture

Although this doesn't work if i leave the default Block title as that of the Menu; but if i set a block title to be that of the menu; then i can find it doing a search in translation interface and the translation works.

jose reyero’s picture

Component: Code » Blocks
Status: Active » Closed (won't fix)

No follow up for too long. Cleaning up issue tracker for 6.x.