I would like to be able to create some sidebar blocks (aka Administrator Defined Blocks) for my English/Japanese site, but there is no way to translate these.
Ideally, there would be a translate function like there is for nodes. If that's not possible, it'd be nice to be able to use the Localization.module's 'manage strings' function, but strings for Administrator Defined Blocks don't appear there.
i suppose there are a couple workarounds, but neither of them is really desireable:
- Create separate blocks for each language, and show/hide them using the path setting. It works, but this is the kind of problem that i18n features hope to solve.
- Write my own modules. This is cumbersome just for static content (i have potentially a lot of sidebar blocks to insert). Also, would have to dig around to find out how to detect language tags (cant find documentation on that).
Comments
Comment #1
Gidget Digit commentedI just wanted to add that I am very interested in any developments in this direction as well. I have 4.5.0 installed with the newest cvs of i18n, but could not for the life of me figure out how to translate the side blocks that we have created.
I'm still not sure of how to properly get the path's working, and cannot write a new module.
So, if anyone has ideas, they would be most welcome!
regards,
-=pj=-
(http://www.nefac.net)
Comment #2
jose reyero commentedAbout the blocks, you can create PHP blocks, and enclose strings with t(), which will translate them using the localization system.
If you use node listings or taxonomy terms in your blocks, you should use then the new 'db_rewrite_sql' function which has been introduced in Drupal HEAD. This function, properly used, will apply language conditions along with permissions to your queries.
Anyway, I agree this 'language' blocks would be an interesting feature for the future...
Comment #3
jmlane commentedInteresting idea, I noticed this block translation issue myself when creating a few admin defined blocks for my french/english site. Jose, is there a way to currently translate the title of these admin defined blocks using a similar method as the one noted above? I don't know if the title values get parsed in the same manner as the content of a block does, so I'm not sure using the t() function would be any good.
Thanks,
Jonathan
Comment #4
robertgarrigos commentedI notice this post relates to a cvs version of what provably was drupal 4.5.* or even less. the first poster says:
Which means that this workaround worked in that version. However I'm trying this with 4.6.3 and cannot make it work. Other paths work ok but system doesn't understand when I restrict a block to 'en/*'. Is that a feature which worked with previous versions to 4.6.3 only?
Comment #5
robertgarrigos commentedI just posted a patch to apply to block.module (drupal 4.6.6) in order to be able to use that workdaround with blocks. You can find it here: http://drupal.org/node/33113
Comment #6
robertgarrigos commentedSorry, I mixed up the versions. This is working for drupal 4.6.3, most provably for any 4.6.x. Although it might work with 4.6.6.... it's now out yet :-)
Comment #7
jozef commentedI have the same question as #3. How to translate a block title?
Comment #8
Marc Bijl commentedI tried another workaround for translating blocks using flexinode and i18n:
- http://drupal.org/node/37118
It might seem a bit difficult (and maybe it is :D), but it works great for me now!
Don't know about translating the title btw...
Comment #9
jose reyero commentedSee the new i18nblocks.module