The site I am working on uses i18n and is bilingual: english and french.
The nodeasblock module could be a very interesting option on multilingual sites, because it allows to use multilingual workflow control that i18n excellently implements for nodes but not for blocks.
Currently, the nodeasblock/i18n duo completely ignores multilinguality: If I assign the english node "About" as block to the bottom bar of my site, the About node shows up also on the french version of the site. The french translation "A propos" does not show up at all.
Desired behaviour would be
1) block from node should show on specific languages according to the settings of the i18n module (language selector).
The next level would be
2) if translation of node is available in current language, show the translation of the node. This could require some user interface adjustment, because it _could_ be confusing for the user that suddenly a node shows up as block shows that has not been configured to do so. But this could be a major workflow improvement: once a node is assigned as block to some website real estate, the site can grow organically. If you add another language to the site, you just create a translation of the node you use as block. The new translation automatically pops up at the right place. No need to go to the block admin page.
I need to get this done somehow, I appreciate any thoughts or suggestions.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | nodeasblock_i18n_02.patch | 758 bytes | jose reyero |
| #4 | nodeasblock_i18n.patch | 1.32 KB | jose reyero |
Comments
Comment #1
jose reyero commentedI think this simple one line patch may work (last line).
As we have nid, using db_rewrite_sql should add the language conditions for nodes there and only select the blocks for the current language.
If you just set both blocks in the same place, the right one will show. The other option may be using i18nblocks.module metablocks to show whatever block depending on language.
Comment #2
alex_b commentedThanks Jose, will try that. Do you see a chance how to implement 2) ?
Comment #3
alex_b commentedJose,
The patch you suggested has no impact on viewing a nodeasblock block, it alters a query that is being called on listing nodes as blocks. I think there needs sth. to happen a couple of lines further down:
Comment #4
jose reyero commentedHere's a patch for i18n integration. It shouldn't break anything if i18n is not enabled.
It replaces the node by its translation on the fly. Further explanation on the code comments
Also, this 'nodeasblock_translate' function could be used inside the theme function if you don't want to patch the module..
Comment #5
alex_b commentedJose,
Thanks for the patch, great! I am worried about the performance tax of an additional node load.
Instead of
Should we...
...?
Comment #6
jose reyero commentedAlex,
Yes, I think your code is better. I've tried it and works fine. The only change in behaviour is that it shows the original node if no translation exists, that is also all right I guess
So I've recreated the patch using your code and fixing a small typo ($nid)
Plus, maybe a workaround if you dont have too many of these blocks, you can use block visibility settings for blocks to display only for given languages, using paths like: en/*, es/*, etc..
Comment #7
mfredrickson commentedOops. I applied this patch but forgot to update the issue queue.
Thank you Jose and Alex for writing and testing these patches. Like most module developers, I want to be int'l compatible, but I'm not entirely clear when I need to be.
Cheers,
-mark
Comment #8
(not verified) commentedComment #9
makangus commentedFor anyone trying to use the same patch for 6.x-1.0-beta1 and i18n 6.x-1.9, do the following instead