When I create a menu the menu title is searchable in translations and I can translate it.

When the menu is handled by taxonomy_menu - it is no longer translatable (or searchable) :(

I have tried to find where taxonomy_menu messes with the title, but can find no such place, and AFAIK taxonomy_menu should not mess with the displaying of this?

Although if taxonomy_menu does NOT mess with the display - how does it put the (count) - after each menu item, when this has been selected?

I haven't found out which function adds the (count) thing.. perhaps you could give me a hint - and I can go from there

Comments

indytechcook’s picture

@klavs, Taxonomy adds the menu title to the menu_links table via the menu_link_save function. It does no alter when the menu block is being displayed.

It has to save/update the title from the term. Not sure how the menu item would be created if it didn't :)

Here are the places where the menu link name is set (in order):

Look at the function taxonomy_menu_handler(). This is called from several places (hook_taxonomy, hook_nodeapi, vocab form submit handler). It is passed an $args array. One of the elements of the $args is the term object. This contains $term->name that will be initial used to create the title.

_taxonomy_menu_create_item() take the $args array and creates an $item. In the creation of the $item array, the 'name' is set. If the $args['tid'] is 0 then is pull the $vocab object and uses that name.

  $item = array(
    'tid' => $term->tid,
    'name' => t($term->name),
    'description' => t($term->description),
    'weight' => $term->weight,
    'vid' => $term->vid,
    'ptid' => $ptid,
    'menu_name' => $args['menu_name'],
    'language' => $term->language,
  );

Then taxonomy_menu_handler() calls hooks to alter the $item. See http://drupal.org/node/380652 for the update/insert hooks. In taxonomy_menu.module it calls taxonomy_menu_taxonomy_menu_insert or taxonomy_menu_taxonomy_menu_update which both call _taxonomy_menu_item(). This function does edit the title to add the node count (if selected).

Once the hooks are done, the $item array is sent to _taxonomy_menu_save() where the $link array is built and sent to menu_link_save. THis is the initial $link build.

  $link = array(
    'link_title' => t($item['name']),
    'menu_name' => $item['menu_name'],
    'plid' => $plid,
    'options' => array('attributes' => array('title' => t(trim($item['description'])
      ? $item['description'] : $item['name']))),
    'weight' => $weight,
    'module' => 'taxonomy_menu',
    'expanded' => $expanded,
    'link_path' => $path,
  );

Then hook_menu_link_alter() is called from the menu_link_save() and that can be used in any module. During hook_link_alter hook_translated_menu_link_alter() is called (i think) and triggers taxonomy_menu_translated_menu_link_alter() which translates the menu item based upon i18n.

Once the item has been saved to the db, taxonomy menu no longer touches it (directly). Some of the attributes that are saved with the menu_link can influence how the menu is displayed but there are way to many different circumstances for me to know/describe.

I know some of this is overcomplicated and will be simplified for taxonomy menu in D7 (hopefully back-ported to D6).

Cheers,
Neil

tomsm’s picture

subscribing

ss54’s picture

Title: menu title not translatable » My Block Title is not Translatable
Component: Code » User interface
Category: bug » support
Priority: Normal » Critical

I created a block in English with its block title set. I went to (translate interface) and I searched the block title and I translated it into Arabic. When I switched to the Arabic interface the title was not translated. Can anybody why this is happening. Other translations of Block are normally translatable. Thanks for any one who gives a hand.

barrett’s picture

Status: Active » Closed (won't fix)

This support request has had no activity in the over a year. I'm assuming the need has passed. Feel free to reopen if you still need support on this issue.