I'm setting up a drupal website, translated into two languages: English & French. The translation works well, thanks to the LOCALE and i18n modules.

I'm getting a hard time trying to display a block on french pages, but NOT on english pages... Same goes for "english blocks", I don't want 'em to show on french pages...

The solution, I think, is to use the "Page specific visibility settings" in the "administer » blocks" configuration page. I'm trying to use the "Show on only the listed pages" function to make my "french block" appear ONLY on french pages. I need to put ALL the pages that my block will show up, and everytime I add a new link in my block, I need to go back to the block config page and add that new link to the config... This is a lil' annoying!

I'll give an example here :

I have my website, say ---> www.mywebsite.com that shows an english page as startup page. In the browser, it looks like that : "www.mywebsite.com/?q=en". If i go in the documentation section on my website, choosing "cars" in the menu, I get an URL like this one : "www.mywebsite.com/?q=en/doc/cars".

With the "Show on only the listed pages" function, wouldn't it be easier for me to put something like "en/*" for that menu to show up only in english pages, and "fr/*" for the "french blocks" to show on french pages? I tried it, it doesnt seem to work! I need to put URLs like "doc/cars/*" or "doc/*", but I can't take advantage of the language that shows up in the URL...

Any idea?

Comments

behindthepage’s picture

I had similar problem and solved it by doing the above.

The other way you could do it is to have two taxonomy Terms English and french and set the taxonomy of your english pages as english etc... and have a custom block display based on the taxonomy of the page.

gpdinoz
"If we can see further it is because we stand on the shoulders of giants"

Regards
Geoff

eriktux’s picture

Thanks for your quick reply!

When I was reading your answer, I knew these were good solutions! But when I tried them, huh... :(

I tried the "en/*/*" thing, but it doesn't seem to work for me.. What version of drupal are you using? I'm on 4.6

For the taxonomy thing, it looks like a good idea but... I don't know how to do it... You want me to set the taxonomy of my english pages as english, where do I do that? And how can I have a custom block to display things based on taxonomy? When I create a new custom block, I don't see any options to set it to a taxonomy term!

Please help

behindthepage’s picture

Create a custom block with the following snippet

<?php if (arg(0) == 'en'){

print "Put your english stuff here";

}

Same deal for the french

for more info search on arg

gpdinoz
"If you're not getting the answers you want maybe you're asking the wrong questions"

Regards
Geoff

hoelterhof’s picture

> The other way you could do it is to have two taxonomy Terms
> English and french and set the taxonomy of your english pages as
> english etc... and have a custom block display based on the
> taxonomy of the page.

Can you please explain to me how one can configure a block so that it's only visible if the page matches a taxonomy-term? I can't configure my blocks that way :-(.

asiby’s picture

Choose to evaluation the display mode using PHP and use the following code for determining with language you want the module to be display with:

For french ... global $language; print ($language->language == 'fr');
For english ... global $language; print ($language->language == 'en');

Live long ... and prosper!