First off: Love Panels. Thanks for all the hard work.

I have created a custom block and am using i18n for translation with block translation turned on. When editing the block I can set the language to English only. When I use the block in a Flexible Panel it will continue to display even if the user has selected another language. If I use the block anywhere outside of a panel it will hide it if the language is not English. All other content in the Flexible Panel will appear in translated form or

Is this a bug, or feature, or am I doing something wrong?

I know I can create a visibility rule for the pane to restrict it to English but I thought that Panels would respect the language definition for blocks like it does for nodes. There is also a language neutral option for the block language which I would think should display for all languages.

Thanks in advance for any input.

Comments

crea’s picture

subs

Enno’s picture

I have the same problem as the original poster:
Multilingual site with i18n and language switcher activated.
Translated blocks outside panels work fine.
Language restricted views inside panels work fine (view filter: language = user language).
Translated nodes inside panels work fine.
Translated blocks inside panels don´t work: the original language of the block is always used, no matter what language the user is switching to on the site using the language switcher.

Workaround for me is to created a custom content type for the content that was originally created as a block, but would be nice to have the translation working for blocks as well. All under the assumption that I am not missing something.

merlinofchaos’s picture

Is block translation provided by a module? I have no idea how block translation works or at what point.

Perhaps it's only handled properly if you set the style to system block?

bryanhidalgo’s picture

Same problem here, Panels ignore string translation.

bibo’s picture

Component: Display rendering » Code
Status: Active » Fixed

Perhaps it's only handled properly if you set the style to system block?

@merlinofchaos , that was a pretty good "guess", if you had no idea. Simply changing the style worked :)!
This whole issue is pretty weird, especially since views-blocks translations worked in panels with any style.

Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sobi3ch’s picture

Version: 6.x-3.3 » 6.x-3.7
Status: Closed (fixed) » Needs review

don't work for me :(

but I noticed that panel dosn't change language variable $node->language so I've fix this by hook_nodeapi in panel.module file:

function panels_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
	if($op == 'load' && $node->type == 'panel') {
		global $language;
		$node->language = $language->language;
	}
}
Anonymous’s picture

I'm sorry, I don't quite get this. Can you explain in a little more detail what you did here? You added hook_nodeapi to page.module?

merlinofchaos’s picture

Status: Needs review » Closed (fixed)

This doesn't make any sense to me either. Worse, it's not really related to the original issue (Yes, both are about translation, but #7 is about panel nodes and the rest is about blocks).

Returning to previous state; if you wish to continue with this, please file a new issue. Also, you may need to be explicit in detailing what is wrong and how you think this fixes it. My gut feeling is that this is not right, and that core is supposed to be setting $node->language for us.

rougevert’s picture

Version: 6.x-3.7 » 6.x-3.9

Hello Merlin, I got the same issue then #1 on my website, even not fully in the same logic : in my website, custom blocks defined as "translatable" and translated stay in default language while moving from one language to another. I try, as in #1 to put in in "english" to see then if it is possible to assign on block per language in my panel, but i got the same result : a block defined as "english" is still displayed whatever the language is set.

tinker’s picture

Here are three possible solutions that are working for me. All of them assume you have i18n Internationalization module http://drupal.org/project/i18n installed and configured to provide content translation with PATH PREFIX or DOMAIN negotiation enabled.

  1. Make sure panel content type is translatable.

    • Navigate to CONTENT MANAGEMENT -> CONTENT TYPES -> EDIT PANEL
    • Set MULTILINGUAL OPTIONS to "Normal - All enabled languages will be allowed."
    • Navigate to you panel edit page SITE BUILDING -> PANELS, select a page to edit
    • Go to the LAYOUT tab
    • Click the edit icon for a block and select STYLE -> CHANGE
    • Set the style to SYSTEM BLOCK
    • Go to the block edit page SITE BUILDING -> BLOCKS
    • CONFIGURE a block that is being used in the Panel page
    • Set MULTILINGUAL SETTINGS to "All languages (translatable)"
    • Make sure you have translated the block content
  2. Have blocks for specific languages
    • Navigate to CONTENT MANAGEMENT -> CONTENT TYPES -> EDIT PANEL
    • Set MULTILINGUAL OPTIONS to "Normal - All enabled languages will be allowed."
    • Navigate to you panel edit page SITE BUILDING -> PANELS, select a page to edit
    • Go to the LAYOUT tab
    • Create a block for each language in the same are of the layout. Set a visibility setting based on USER LANGUAGE.
  3. Code block to detect language using PHP input. Need PHP knowledge to implement.

    • Navigate to CONTENT MANAGEMENT -> CONTENT TYPES -> EDIT PANEL
    • Set MULTILINGUAL OPTIONS to "Normal - All enabled languages will be allowed."
    • Go to the block edit page SITE BUILDING -> BLOCKS
    • CONFIGURE a block that is being used in the Panel page
    • Set MULTILINGUAL SETTINGS to "All languages (translatable)"
    • Using the PHP input format add language detection and create a case condition for all the langauges.
      <?php
      global $language;
      switch ($language->language) {
        case "es":
      ?>
      Spanish HTML code
      <?php
        break;
        case "en":
        default:
      ?>
      English and Default HTML code
      <?php
        break;
      };
      ?>
      
Arlina’s picture

System block style solved the issue for me. Thanks!

chlee’s picture

For me #11 step 2 worked out fine.
Thx for this post!

AaronBauman’s picture

Version: 6.x-3.9 » 7.x-3.x-dev
Status: Closed (fixed) » Active

Same issue for D7, but changing pane style to system block doesn't fix the issue.
I'm not sure that options from #11 apply - I can't find any multilingual settings for panels.

halp!

AaronBauman’s picture

I see now that comment #11 is referring to panel nodes.
I'm having trouble with regular old panels pages not respecting multilingual settings, which is what i thought the OP was about.

espurnes’s picture

I tried #11 option 1, but no effect.

What I saw is that:

- The translation doesn't work if the block is assigned to a theme-region and you try to show it in a panel-region.

- The translation works if the block is not assigned to a theme-region.

pendaco’s picture

Issue summary: View changes

I'm running into the same problem as espurnes https://www.drupal.org/node/784648#comment-8244413

- Using the Block languages sub-module from i18n (1.11).
- Panels (3.4)

Using a block I added (title and body set to 'Make this block translatable') and translated to French. The block is added to one of the theme's regions.

When I use that same block in a panel page the block stays in English. As soon as I remove that block from the theme region it was in, the block on the panel page actually shows the correct French translation.

A work-around would be to duplicate that block for the time being, but a fix would be better :P If it's fixable by Panels though and not a core issue?

Jeffrey C.’s picture

Status: Active » Closed (duplicate)