Hi,
My setup: I have a site with four languages. Language negotiation set to current language only. Each menu item has it's own language.
My problem: I needed a condition based on menu items that work in all languages (that is, show a block on "About" pages across all four languages). In Context module Menu condition form displays menu items that lead to nodes only in current language as query was altered by i18n module.
Solution: I had to disable rewriting of query by i18n module so I did this. i18n_db_rewrite_sql() function in i18n.module asks i18n_selection_mode() function whether to rewrite the queries. If called with an argument "off", i18n_selection_mode() function remembers the setting in a static variable and disables node query rewriting on Context admin pages.
This brings down to this function you can use in a custom module:
/**
* Implementation hook_init
*/
function mymodule_init() {
// Allow multilanguage menu display in Context module
if (arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'context') {
i18n_selection_mode('off');
}
}
I'm not sure if this is a feature that Context should enable. It's more like a scratch for a particular itch.
Hope this helps someone. Cheers
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | work_with_i18n_block-773118-12.patch | 1.62 KB | pbz1912 |
| #8 | work_with_i18n_block-773118-8.patch | 1.56 KB | sreynen |
| #5 | context_i18n_block.patch | 1.46 KB | BarisW |
Comments
Comment #1
yhahn commentedAnyone else using context with i18n and collecting other adjustments needed to make the two play nice?
Comment #2
jmseigneur commented+1
Comment #3
xalexas commentedThis is exactly what I need also. Subscribing.
Comment #4
BarisW commentedHi Young,
we are in the migration of moving all blocks to Context to make our deployments easier using Features. As our site is multilingual (Dutch/English), getting Context to respect i18n_block settings is top prio for us. For now, we have to create a Context for every language, which are 99% identical. This currently is a burden for all sites that are multilingual, so I'm changing the priority to major, if you agree.
If we can test anything, please let me know.
Comment #5
BarisW commentedI hacked the context_reaction_block.inc to make blocks localization settings work with i18n. Not sure if this is the best solution, but it works for us. Comments welcome ;)
Comment #6
hedac commented#5 applied your patch.. but still my blocks don't respect language context.
Comment #7
hedac commentedsorry...
I've just upgraded to 3.x dev version
and now it works.. but I was also missing that I had to create a context with "Require all conditions" for the language to be "logical AND" with other conditions.
Comment #8
sreynen commentedAttached is a D7 version of patch in #5. I'm changing version, assuming D7 work is coming first now.
Comment #9
steinmb commentedVersion 6.x-3.0. My menu-blocks items show up for default language, but if I change language are they are all gone, even the context is "always show". The even more strange thing is that, this only happen on the site front-page, if a navigate any other page the translated menu items get rendered.
Comment #10
steinmb commentedAnd it is prob. not a feature req. this a critical bug, then it brakes context on multilanguage sites. Pls. correct me if I'm wrong and this is secretly fixed somehow.
Cheers
steinmb
Comment #11
tekante commentedAdding tag for tracking
Comment #12
pbz1912 commentedrerolled patch. Not sure its working.
Comment #13
tekante commentedAfter looking at this issue and the comments I need more information to determine what the requests are, how to duplicate the issues and validate the patches for committing.
It appears the original request has to do with being unable to see menu items that aren't in the current language for selection in the context menu condition. I have set up a site with two languages, a basic page node that is in the primary language and translated into the secondary language, both of which are in the menu. When I view the context menu condition I see both menu items so I am unsure what the provided code snippet is intended to accomplish. I believe a key piece that I am missing revolves around "Language negotiation set to current language only" as I see no way to set that in my Languages Detection and Selection interface (admin/config/regional/language/configure).
Most of the comments appear to be concerned with translated blocks. I have also enabled the i18n_block module and created a block in the primary language that is translated into the secondary language. I place the primary language block using the context block reaction and depending on what language I request my site in the correct version of the block displays.
My testing was done with the latest 7.x-3.x-dev version of the context module.
In order to proceed with applying the suggested patches, this issue needs a clear description of what is trying to be accomplished and a description of how to setup a site to demonstrate the problem such that a maintainer not overly familiar with all of the internationalization modules can replicate. At that point I'll be able to verify that the patches resolve the issues and commit. At the moment I am unable to configure a site such that I can validate the necessity of the patches and their functionality.
Thank you.