I found the Nodes In Block module very useful, but would like to use it inside a multi-language site.
To add this feature, I think the best way is to add template_preprocess_node() and hook_theme_registry_alter() functions.
Then a new theme files node-nodesinblock-default.tpl.php
I will base my work on the Node Block module which have the translation enable. But the new module is still on development !
If you have already think about adding this multilanguage feature, please contact me: dsnoeck [the email character] gmail [you know the last 4 characters]
Otherwise, I will keep you updated
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | 425188.patch | 1.08 KB | neerajskydiver |
| #21 | 425188-nodesinblock-fix-i18n.21.patch | 3.27 KB | drzraf |
| #20 | 425188-nodesinblock-fix-i18n.patch | 1.71 KB | drzraf |
| #14 | nodesinblock-translate.patch | 999 bytes | netsensei |
| #3 | nodesinblock_translation_patch.diff | 1.32 KB | dsnoeck |
Comments
Comment #1
swentel commentedMultilangual support should be included indeed, not sure about the preprocess_node solution though, wouldn't it be more handy to check on tnid in the node object ? Haven't done any work on that though, so if you have any patches, feel free to post!
Comment #2
dsnoeck commentedHi swentel,
You are right it wasn't the correct way to use preprocess_node. I have found the right way. Had some check for translation available etc.
We can do some more test to check the translation setting define for the website.
See below the added code in the function _nodesinblock_show() after the node_load() function.
I alse have attached the diff patch.
Comment #3
dsnoeck commentedHere is a new patch to check against the site default language value. I use the function language_default() to get the default language.
Comment #4
swentel commentedHi, I tested and committed your patch (see http://drupal.org/cvs?commit=196138), works perfectly. Can you try out the next development build, if all is ok, I'll roll out a new release this week.
Comment #5
dsnoeck commentedI will test it during the next week and will probably send you others patch to add more functionalities.
- Damien
Comment #6
swentel commentedCool, looking forward to that. I've had some discussion with a few colleagues too about the multilingual support and I think it needs some more finegraining before I roll out another release, eg:
I'm going to think about this some more and post other patches myself. I'm marking this one as fixed for now, I'll let you know when I have other patches too by posting the links in this thread.
Comment #8
miruoss commentedHi there
I took over Damien's work so I will continue this discussion. :) I'm still running into multilanguage problems, even with Damien's patch. I therefore reverted it and added a db_rewrite_sql() around the $query on line 203. It now reads:
This should solve the question about language fallback and in the same time checks if the current user has access to the node being shown. Using the module i18n, the admin can already define the language fallback policy at admin/settings/language/i18n so why add another fallback policy selection. This fallback setting is then used by i18n using hook_db_rewrite_sql() to rewrite the node selection query.
I personally use the module active_translation (http://drupal.org/project/active_translation) by now. It comes with another hook_db_rewrite_sql() and another language fallback policy.
Comment #9
swentel commentedHmm makes much more sense indeed! I'll test it this weekend, probably commit it too :)
Comment #10
swentel commentedOk, it took me a while to commit this, sorry about that. Can you test the new dev/cvs version to see if all goes well ?
Comment #11
miruoss commentedI tested the CVS version which looks good to me.
Cheers,
Michael
Comment #13
tlangford commentedHi. I really like this module and too have a multilingual site. I'm having problems actually getting Drupal to display two different nodes depending on the current language. Can someone write a step-by-step guide to adding this please?
Keep up the good work!
Comment #14
netsensei commentedNot sure if I should open a new issue. In 7.x this does not work.
Installed: i18n, locale, nodesinblock. The node which was added to the block is shown, not the translated node for the current language. I've created a patch which allows translated nodes using Translation Helpers (http://drupal.org/project/translation_helpers) rather then writing a function in nodesinblock which essentially would do the same.
Patch will translate all nodes in a block. No exceptions. We might want more finegrained control (on a block level: which get translated, which don't) but such a feature might add more complexity in the wilderness of block contexts (i.e. show block on language x, blocks in panels,...)
Comment #15
swentel commentedcommitted and pushed.
Comment #17
rudins commentedLine 430:
$tnode = translation_helpers_get_translation($node, $language->language);should be:
$tnode = translation_helpers_get_translation($node, $language);Comment #19
remaye commentedSorry to re-open this issue, but is NodesInBlock really working now with multilingual site and how ?
I enabled : locale / content translation / i18n / block translation
I created a Nodes In Block block and "block translation" module allow me to enabled my different languages in theblock settings.
When I select the block in Nodes in Block tab, for a node form and its translations, I would expect it display the block in all selected languages, with the corresponding translated content in it.
Instead, it creates as many instances of the block than the number of languages and display all of them in the page regardless of the language of the page.
The only solution I have is to create one Nodes in Block per language, enable it only for its language and select it in the node form for the correct translation.
Is it designed like this or did I miss something somewhere...?
Thanks for your help.
NB: the same issue has also been reported here : http://drupal.org/node/1608350
Comment #20
drzraf commentedWhy a dep on
translation_helpers.module'stranslation_node_get_translations?This function is here: http://drupalcode.org/project/translation_helpers.git/blob/refs/heads/7....
And is a very simple wrapper around http://api.drupal.org/api/drupal/modules!translation!translation.module/...
Here is a patch.
But... it does not fix the main issue which is that all blocks (each per translation) for a given node are displayed one below the other.
I'll come up with a workaround later.
Comment #21
drzraf commentedhere it is.
please review and/or enhance, commit and enjoy
Comment #22
hkirsman commented#21 didn't work for me. Applied the patch, deleted cache
Comment #23
drzraf commentedI'm using it in a production environment, maybe your issue comes from another cause
(patch applies ? theme support i18n ? ... what does not works ?)
Comment #24
hkirsman commentedIt still showed both nodes in the block. I'm not aware that there are any patches applied. Does it work for other people?
Comment #25
neerajskydiver commentedIn #20 comment, the patch is using the function "translation_helpers_get_translation" which is part Translation helpers(https://www.drupal.org/project/translation_helpers), and this module is not added as a dependency for the module. This patch will add this and a $language global variable usage in module, which will fix the issue.
Comment #26
drzraf commented