I'm not sure if this is a bug or just a need-to-know-workaround situation, but this is what I encountered:

- set up three nice_menus each for English, Spanish and Portuguese, each of which is associated with a corresponding menu created with language-specific links
- created one multilingual block where each nicemenu was associated the the appropriate language

Upon saving, the blocks would not display in appropriate location, and when re-entering the multilanguage block edit form, the values selected above would not display as set -- basically, multilanguage block was not assigning them to the appropriate entry in variables table.

Looking at i18nblocks.module, the i18nblocks_save function calls an explode() function (line 132) that looks for an underscore to divide the module from the gamma (which i take is basically Delta for i18n, yes?) for dealing with multiple instance-modules. So in assigning the variable, explode('_', $path) evaluates to explode('_','nice_menus_1') which puts 'nice' rather than 'nice_menus' in $module -- which in turn assigns the wrong value to the variables table, thus not displaying.

Not sure what to do about that codewise, but i went into nice_menus and modified every instance of nice_menus to nicemenus (including filenames) and now things display as I'd expect. Only thing is that I'm having cleanup problems in the database, but that's a different issue.

Would you consider this an i18nblocks issue or a nicemenus issue? You can't very well control how people name their modules, but changing one module to deal with this rather than the dozens of modules that have '_' in their names is probably more likely to happen.

Not sure how to do it, though...you can't really tell explode() to ignore the first occurrence, but might substring assignment using the last index of '_' as the dividing line work instead?

-jfr

CommentFileSizeAuthor
#6 i18n_blocks.patch812 bytesjuanfe
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davemybes’s picture

That's some good investigation there - I always wondered why the two modules didn't work together properly. I thought I'd post my solution to the problem, just in case you found it useful. It doesn't require any code modifications, so its a neater way to do things (at the moment), in my opinion.

Basically, each language had its own menu and each menu was put into a Nice_menu block - pretty much as you did. The thing I did different was then to allow the English Nice_menu block to appear only on pages en/*, and the French block on fr/*. This works well for me - take a look at http://mbacasecomp.com to see it in action.

Hope this helps (until another solution presents itself).

juanfe’s picture

That's a good solution -- better than mine. Sucks that I can't seem to use it, though -- i haven't been able to get Clean URLs working in my hosting environment... but once it moves to permanent hosting elsewhere it may very well do the trick instead of having to custom mod a module...

Thanks!

-jfr

davemybes’s picture

What is your hosting environment? Windows?

juanfe’s picture

Nope, Linux and Apache -- but I don't have control over web server and don't believe mod_rewrite is installed...

In honesty, I haven't poked around that much with it, and perhaps my hosting provider would make the changes for me...

davemybes’s picture

I'm pretty sure your host will do it for you, but I've just realized there's another way to do this: use /q?=en/* or /q?=es/* instead. That should work for you. Be sure to include your base url if you're installed in a subdirectory.

juanfe’s picture

Title: Multilingual Block won't display nice_menus » Patch file for i18nblocks and modules with underscores in name
Status: Postponed (maintainer needs more info) » Needs review
FileSize
812 bytes

Simple fix that should let i18nblock work transparently with blocks generated by modules that have an underscore in their name. Patch file is attached. Tested with nice_menus and taxonomy_block

--- drupal-4.7.x-dev/modules/contrib/i18n/contrib/i18nblocks.module	2006-05-11 20:41:58.000000000 -0400
+++ devel/modules/contrib/i18n/contrib/i18nblocks.module	2007-01-12 15:32:24.000000000 -0500
@@ -129,7 +129,13 @@ function i18nblocks_load($delta){
 function i18nblocks_save($edit, $delta){
   $block = array('name' => $edit['name']);
   foreach($edit['i18nblocks'] as $lang => $path){
-    list($module, $gamma) = explode('_',$path);
+    $block_members = explode('_',$path);
+    if (count($block_members) > 2)
+    {
+      $head = array_shift($block_members);
+      $block_members[0] = $head . '_' . $block_members[0];
+    }
+    list($module, $gamma) = $block_members;
     $block[$lang]['module'] = $module;
     $block[$lang]['delta'] = $gamma;
   }
juanfe’s picture

This also addresses http://drupal.org/node/72784

- jfr

Jose Reyero’s picture

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

This version is not supported anymore. Please check out latest ones.