1

I used the Block Image module to create some content; now I want to give the site's editor the permission to translate the blocks, but I can't seem to find how I can do that. There's no permission to let a role be able to translate a block content.

How do I grant permissions for translating block content?

  • have you tried the block permissions? – wranvaud Apr 9 '16 at 22:02
  • Yes I did, unfortunately I can't find anything on google regarding i18n and block translation permission – user23288 Apr 10 '16 at 4:05
  • 1
    The permission in question is not obvious, if i remember correctly it was a combination of permissions. Try: Administer blocks + Translate content + Translate interface texts + Administer content translations. Test and revert one by one... – Volker Apr 12 '16 at 20:40
  • Are you using 'Image Block" (drupal.org/project/imageblock) and not "Block image"? – Pierre.Vriens Apr 12 '16 at 21:05
1
+50

I hope I got the question right, it seems pretty simple (@Volker almost got it in his comment):

  1. Install i18n_block
  2. Give the target user role the permissions: "Administer blocks", "Translate interface texts" and optionally "Use contextual links"
  3. Configure the target block to be translatable by selecting "Make this block translatable" in the block's configuration
  4. Click on the "Translate" tab (or the "Translate" contextual link); this is a new option available only after you do step 3

Here are three example screenshots:


Configure block to be translatable, optionally picking target languages

enter image description here


After saving the configuration, the block's contextual link has the "Translate" option

enter image description here


... which eventually leads you to the Block's translation page

enter image description here

Good luck!

P.S.: Whether you use the Image Block module or not, should not really make a difference, this was a red herring if I am not mistaken. ;-)

  • Thanks for your insanely detailed answer, I followed the instructions you mentioned but unfortunately with another role when I go to structure/block/manage/block/1/translate I get 'You are not authorized to access this page' – user23288 Apr 17 '16 at 6:34
  • If the Stephanos approach doesn't work, you have a permission issue, probably caused by a third party module. – Sohail Apr 17 '16 at 6:37
  • Yep, I missed Translate interface texts ! that simple! thanks – user23288 Apr 17 '16 at 6:39
2

Block level permissions for administration is not provided in core. There is a module Block Access which provides block level permissions for admin interface.

This module adds a set of global permissions for creating, viewing, moving, enabling, disabling and configuring blocks as well as permissions at the individual block level. These permissions only affect the admin interface, front-end view access is handled in core.

UPDATE:

Blocks are not content, so the permission to translate content won't help here. To be able to translate blocks you need to download Internationalization and Variable modules and enable the module Block languages [i18n_block] which ships with Internationalization module.

  • what about a translate permission? even though my user has the ability to translate content, and has access to configure blocks, he cannot translate – user23288 Apr 14 '16 at 11:16
  • Blocks are not content, so the permission to translate content won't help here. I've updated my answer with the information to enable translation of blocks. – Елин Й. Apr 14 '16 at 16:17
0

To my knowledge there is no such permission you can use for translating blocks. Any user who has permission to administer blocks, will also have access to the "translate" link that is typically used to translate blocks in other language. However there are 2 possible work arounds you may want to consider, as further detailed below ...

Option 1: using the Rules module

But, the paths of such block translation links, typically include the language code (fr, nl, es, etc) as part of their paths. With that, you should be able to get it to work (or at least have some type of work around) by using the Rules module, using a variation of what is described in my answer to the question "How to make the permissions of a module more granular?".

You could start from the very same Rule (in export format) in that answer, and tune it to fit your exact needs. If you have a lot of such blocks, then probably the toughest part would be to tune the regular expression so that it matches the URLs of your blocks for which you want to restrict access. If you only have a few blocks you want to restrict access to, you shouldn't need the Rules Condition with the regular expression. Tuning the roles to be checked, and or the Rules Action should be straight forward.

Option 2: using the BEAN module

You could use the Bean module for this. Here is a quote about its project page:

Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require (see screenshot below). The bean content can then be placed around the site just like any other block.

Here are the steps you'd have to complete:

  • Create 1 Block Type for each of your languages, say en, fr, es.
  • Create 1 Block for each of those Block Types, say MyEnBlock, MyFrBlock, MyEsBlock.
  • Adapt the Block Visibility settings for each of those 3 blocks (using the Languages tab), so that they are only shown in the language they correspond to. E.g. for block MyFrBlock you only show it for language fr.
  • Grant the appropriate Bean permissions (= which roles can perform which operations for which Block Types, aka language with the above Block Types configured).

With that in place, it appears to me that you would have a possible solution. Actually from then on your remaining todo is a variation of the question about "How to limit block management by role?". Refer to my answer to that question for more details about this great module (which by the way has been moved to core in D8 ...).

The video tutorial Drupal Bean module tutorial - using Bean Admin UI provides a great introduction to really understand the power of this module, and the kind of things you can do with it (by only using site building techniques, no custom coding involved). It also shows how the Bean module transforms Drupal blocks into fieldable entities.

  • it's such a hard workaround to get this to work, isn't there any simpler solution to Block translation? – user23288 Apr 14 '16 at 11:17
  • Hey @Gus , can you clarify the exact module you are using? See my comment below your question about my doubts. Maybe it helps to come up with other solutions. – Pierre.Vriens Apr 15 '16 at 5:42
  • @Gus: "Sales" starts when the prospect says no ... Have a look at my option 2 that I just added. IMO it's a valid alternative for your interesting challenge ... If you're not familiar with the BEAN module, then it's definitely worth investing time in it (even if it was only because it's in D8 core now also ...) – Pierre.Vriens Apr 15 '16 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy