It's a good idea that image block get transation options like normal block

Comments

Artnetik’s picture

I agree. Looking forward to seeing some development in this way! :)

JaapB’s picture

For Drupal 6 you can add this code in sites/all/modules/i18n/i18nblocks/i18nblocks.module within the i18nblocks_preprocess_block function (rule 253):

  // Imageblock has no i18nblocks support, here a ugly fix.
  if($block->module=='imageblock') {
    $localizable = _i18nblocks_list();
    if (!empty($block->content) && $localizable && isset($localizable[$block->module][$block->delta])) {
      // Get the variables for the standard theme-imageblock function.
      $db_block = db_fetch_object(db_query('SELECT body, format, fid, data FROM {imageblock} WHERE bid = %d', $block->delta));
      // Translate the body only.
      $db_block->body = i18nstrings_text("blocks:$block->module:$block->delta:body", check_markup($db_block->body, $db_block->format, FALSE));
      // Use the translated body to re-create the block content (including image).
      $block->content = theme('imageblock_block', $db_block);
    }
    if (!empty($block->subject) && $block->subject != '<none>') {
      // Check plain here to allow module generated titles to keep any markup.
      $block->subject = i18nstrings_string("blocks:$block->module:$block->delta:title", $block->subject);
    }
    $variables['block'] = $block;
    return;
  } 
JaapB’s picture

StatusFileSize
new2.46 KB

Sorry, here is the full patch for drupal 6
Included the setting to make a block translatable.

kenheim’s picture

Since this issue is for version 7.x-1.2, I think it would be great if there were a patch for that one also.

Belham’s picture

Hey!
Any hope for a patch for D7?

phily’s picture

Issue summary: View changes

D7 patch would be useful for me too ;-)

jmuzz’s picture

Version: 7.x-1.2 » 7.x-1.x-dev
StatusFileSize
new739 bytes
new832 bytes

Here are 2 patches to make it work in Drupal 7, one for i18n module and the other for imageblock. Both must be applied.

There is probably a better way and some of the help text could also be corrected but it works.

It also doesn't check for i18n_string so make sure i18n is active before applying these.

jmuzz’s picture

Title: i18n » i18n support
Status: Active » Needs review
StatusFileSize
new2.03 KB

This version will work without any changes to i18n_block and it won't break anything if i18n isn't there.

phily’s picture

#jmuzz: thank you for patch #8

https://drupal.org/node/1252144#comment-6736460 adds support for WYSIWYG in translated regular block body.
Can this be easily ported to translated imageblock body?

maxilein’s picture

StatusFileSize
new2.36 KB

Hi,

thanks for the #8 patch. Seems to be working with the latest dev version just fine.
I have adjusted the patch to the current dev release and also added the i18n_block and i18n_string dependencies to the info file.

R,

Status: Needs review » Needs work

The last submitted patch, 10: imageblock-i18n_support-1373794-10.patch, failed testing.

doxigo’s picture

Patch #8 seems to be working, thanks

interdruper’s picture

Status: Needs work » Reviewed & tested by the community

#8 works fine.

About #10, there is no need to add that dependencies, checks are performed in code.

The last submitted patch, 8: imageblock-i18n_support-1373794-8.patch, failed testing.

mvdve’s picture

StatusFileSize
new3.13 KB

Updated the patch so it works with the latest dev version. Also removed the dependencies (Not everybody is using i18n on their drupal site) and set the file path of the patch to the correct values.

dexnob’s picture

Sorry for a question where you insert the patches for the image block is translatable thanks

gauravkhambhala’s picture

The patch seems to add i18 support for body field. Can we also add support for image field?

rgnyldz’s picture

Yes, this module should also allow users to change the image per language.

Any plans on that?