Posted by sullix on May 8, 2009 at 3:41pm
| Project: | Internationalization |
| Version: | 7.x-1.x-dev |
| Component: | Compatibility |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
i18nblocks module uses its own method to theme blocks... so we cannot override the Drupal theme_blocks function in themes (template.php) or in other modules (in particular : Context).
Read : #402150: Conflict with i18n block translation: Context defined blocks don't show up
Thanks
Comments
#1
I'll be following on the Context module issue.
#2
Hi Jose,
I don't see the needs of overriding "theme_blocks()" function. A "hook_preprocess_block()" could be enough.
If you agree this, I can build the patch.
Makara
#3
Subscribing.
#4
One solution would be to get rid of i18n block entirely, and use a single context per language instead...
#632322: Context language condition support
#5
See also #644044: Activating module Block Translation breaks sidebar rendering in the Zen issue queue.
#6
I built the patch, based on cvs DRUPAL-6--1.
I didn't change the code that does the translation, but just moved it from hook_theme_registry_alter() into hook_preprocess_block(). This solves the conflict.
Please review.
#7
#8
Thanks, your patch works great!
#9
Patch works:
Updated i18n to dev version. Applied patch. Confirmed that theme_blocks is rendered correctly. Menus and blocks are still ok.
Thanks!
#10
Updated i18n to dev version. Applied patch. Got this error:
Fatal error: Uncaught exception 'ReflectionException' with message 'Function i18nblocks_theme_blocks() does not exist' in /home/khaleej4/public_html/jobs/sites/all/modules/devel/devel_themer.module:389 Stack trace: #0 /home/khaleej4/public_html/jobs/sites/all/modules/devel/devel_themer.module(389): ReflectionFunction->__construct('i18nblocks_them...') #1 [internal function]: devel_themer_theme_twin('blocks', 'sidebar_first') #2 /home/khaleej4/public_html/jobs/sites/all/modules/devel/devel_themer.module(230): call_user_func_array('devel_themer_th...', Array) #3 [internal function]: devel_themer_catch_function('sidebar_first') #4 /home/khaleej4/public_html/jobs/includes/theme.inc(617): call_user_func_array('devel_themer_ca...', Array) #5 /home/khaleej4/public_html/jobs/includes/theme.inc(1774): theme('blocks', 'sidebar_first') #6 [internal function]: template_preprocess_page(Array, 'page') #7 /home/khaleej4/public_html/jobs/sites/all/modules/devel/devel_themer.module(451): call_user_func_array('template_prepro...', Array) # in /home/khaleej4/public_html/jobs/sites/all/modules/devel/devel_themer.module on line 389
Error disappears after disabling Theme developer 6.x-1.18 (D 6.14).
Also, menus and blocks are ok.
#11
Well, obviously 'Function i18nblocks_theme_blocks() does not exist', since that is what this patch substituted for 'function i18nblocks_preprocess_block(&$variables)'. It looks like the error might be due to some leftover cache. Could you confirm whether your problem persists, after emptying caches?
I enabled Theme developer, and received no errors.
#12
Success for me running that patch against the 6.x-1.2 release - blocks are now back in their place on my subtheme based on the Zen 6.x-2.0 beta 1 release. Thank you very much, makara!
#13
Success for me. Great!
#14
subscribing
#15
The patch in #6 applies perfectly, and is probably the way this should have been implemented in the first place.
This fixes the conflict this module has with the Context module beautifully.
#16
#6 patched.
#17
Will test soon, great work.
#18
Thanks !
#19
Works here, too. I suggest adding this to CVS. Thank you!
#20
Works for me, +1 to commit this.
#21
I'd really like Zen 6.x-2.x to be compatible with i18n, but it won't be until this patch is committed. It has been RTBC for 2 months now.
#22
Works perfectly for me.
+1
#23
The check plain is causing html (a link) in the block title generated via menu_block module to become all not treated as html.
However, there's a comment "// Check plain here to allow module generated titles to keep any markup." that suggestions the html should be preserved by the check_plain, which doesn't quite make sense to me, so I'm thinking I'm not quite getting something.
edit: It appears to be a conflict between panels/ctools. Likely the check_plain is being run twice.
#24
(Looked over the patch and realized the check_plain was a pre-existing condition, so moving back to RTBC, sorry :) ).
#25
Adding my review, patch applied cleanly to i18n dev (2010-Jan-03) and works as expected, thank-you very much makara!
#26
Patch fails against current dev version (march 04):
patching file i18nblocks.module
Hunk #1 FAILED at 287.
1 out of 1 hunk FAILED -- saving rejects to file i18nblocks.module.rej
#27
The patch looks good, though it needs updating for latest i18n/i18nstrings changes (6.x-1.3 security release).
Also the language condition is now supported by context which is a possible workaround, see #4
#28
Re-rolled.
Since this breaks themes, I would still consider this issue a bug. But let's not let pedantic categorization get in the way of committing it. :-)
#29
New patch applies cleanly to updated i18n. (I had to empty caches to see the result though)
Thanks. Let's get this committed.
#30
Great!
Committed. Thanks.
#31
cool, thanks everyone!
#32
Automatically closed -- issue fixed for 2 weeks with no activity.
#33
I reopened the original context issue #402150: Conflict with i18n block translation: Context defined blocks don't show up because it doesn't work on D7.
From the issue in context: "Block managed with context can be translated (string translation) but the translation never show up, always the original content.
If you try to only show a block for a language (in the block settings) it doesn't work, the block is always visible."
I don't get why it doesn't work anymore perhaps it's an other issue now...
#34
Yes, this is another issue.
Besides, i18n uses hook_block_view_alter() to do the block translation. If context doesn't run the blocks through that hook, or it loads the blocks differently to drupal core there's very little we can do.
#35
OOhh! Am I reading this right? Context won't work with i18n?
#36
This issue is fixed.
The work is now going on #1343044: Context and block translation. and #1320864: Context not respecting block language.
@nomad411 right now not, but if you use the patch from the two issue above it will works.
#37
Automatically closed -- issue fixed for 2 weeks with no activity.