Posted by taite11 on January 9, 2009 at 6:14am
| Project: | Internationalization |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
So, I have the "block translation" sub module enabled. But when I go to the "Translate interface" I can't find any strings to translate for the blocks.
I want to translate the titles of various blocks.
Comments
#1
Subscribing. Same problem with 6.x-1.x.dev (November)
Especially with regard to menus - after creation, and enabling as a block,
there is no obvious way to translate the title. This means that you need two
menus set to specific languages rather than one menu set to 'language neutral'.
#2
This may happen when you enable i18nblocks after the blocks are already created. Temporary workaround: edit block, check multlingual settings / save block (even when unchanged).
This issue will be fixed having the block strings properly refreshing when enabling the module, see #356520: i18nblocks implementation of i18nstrings/locale_refresh()
#3
The modules were enabled before creating the menus.
How are you actually supposed to translate a menu-block title?
By using the 'Translate Interface'?
If so, when creating the menu, is there supposed to be a message
such as 'created string: menu: title:'?
#4
Hello,
I think you have to create as many blocks as languages. If you don't want to translate the body, I don't know...
If you're using 10 languages, and having 100 blocks, you will have 1000 blocks...
Maybe is there another solution to translate blocks with bodies?
#5
> If you don't want to translate the body, I don't know...
With the release of version 1.0 stable, it appears that the stated problem has been fixed.
In other words, now you should be able to create one block with just its title translated for each language, using the translate interface (or any module providing a better UI for the translate interface). Further, in the block can be, say, a menu with 10 links. Each link can be translated using the translate interface. The other feature that seems to be fixed is the language designation (dropdown menus) of the blocks and menu items. None of that was working when I originally posted.
> [to translate the bodies of blocks] if you're using 10 languages, and having 10 blocks, you will have 100 blocks
I've no idea how to translate block bodies.
I suppose php 'if/else/case' script could be used. Or perhaps the 'language sections' module.
#6
I am currently on this issue.
Normally, block creation is triggered when creating a menu.
Other blocks can also be created, but in this case they never link to menus
1) A block associated with a menu comes with 1 + n language options, ie
All languages
English
French
None of these settings gives birth to translatable strings: the initial title of the Bloc/Menu does not show up in the Translate Interface
2) a bloc created directly (see above) comes with more promising 2 + n language options, ie
All languages
All languages (Translatable)
English
French
When the second option is set, Bingo: you can get to the translation interface for its title
The problem is that this true multilingual but orphean block cannot be linked back to a menu.
In other words, multilingual blocks do not work for menus
Hope this helps
Note I am using the dev version
#7
Subscribe, menu translation is useless without being able to translate the menu title
#8
> In other words, multilingual blocks do not work for menus
Confirmed! I tried the normal block title translation, which worked as you described, and simply assumed the whole translation thing had been fixed. But as you explain, *menu blocks* are still without title-translation through the translate interface.
I'm sure jose will get around to this eventually, time permitting.
For the moment, it looks like we still have to use a menu-block for each language.
#9
Yes, this is awactly what I did.
Actually, it is easy to do this way: just create as many language secific menus per actual menu and set the menu languages accordingly.
However, this means creating menu items for each language, making menu translation irrelevant as well: with such a scheme, I prefer to set the menu item strings in the corresponding language when I create this item in its secific menu rather using the quite confusing interface translation feature
#10
Working on a new site, I felt into the same issue: block strings are simply not translatable for their most common purpose: menu headers.
I changed the status to bug, as the feature is said to be provided, the search string has provision for looking for blocks but returns nothing except orphean blocks.
#11
Also, it is not duplicate to my knowledge
#12
I changed the title and category as feature request: this seems not a bug, but rather a whole missing piece of code with early documentation (normally, the doc comes after the feature, but not in this case!)
#13
I had the same problem and came up with the following workaround, that might also work for others:
1. Set the menu block title to
<none>in order to disable it.2. Create a block with the setting "All languages (Translatable)"
3. Give the newly created block the title you want to display and put some dummy text in the body. Make sure the block appears above the menu block.
4. Add
div#block-id * p { display: none; }to your theme's CSS (this hides the dummy text).5. Translate the block title via the interface.
Once the issue is fixed, you can just remove the extra block and set the block title to an empty string instead of
<none>.#14
Humm...
Ok got it.
What is step (4) for?
Waiting for a less dreadful solution...
#15
Step (4) is needed, because the block created in (3) will not be displayed if it has just a title and no content/body. Therefore CSS is used in (4) to eliminate the body text whilst preserving the title of the block.
#16
I am sorry, but I still don't understand:
"Once the issue is fixed, you can just remove the extra block and set the block title to an empty string instead of ."
What I thought basically is that you use an extra block temporarily in order to perform the string translation in the right category, then removing this block and rename the menu block using the original string.
This is what I get from "you can just remove the extra block..." and why step 4 did not seem important to me.
However, the next part of the sentence seems not to tell that "...and set the block title to an empty string instead of "
Which block: the temporarily disabled menu block or the extra block? Seems the menu block, but with an empty string, we won't get anything???
Sorry for the slow catch up
#17
Don't worry, the instructions don't make any sense to me either.
For instance, step number 5 - isn't the entire thread about block titles NOT being translatable?
So if you can translate the title of a 'dummy' block, why not just translate the title of the real
block in the first place?
#18
Subscribing
#19
Subscribe to this thread, menu translation is useless without being able to translate the menu title.
Yes. the current issue is still the same, the translation can be enter via the menu translation, but the menu title don't show when the language is switched.
The menu translation should be use for maintain just one menu structure with multiple translation.
Else it make no sense, imagine a site have 100+ pages with 8 languages, the admin will have to create 8 menus, create all the title and adjust the tree all over again.
I've bought the module development book from Packt, but I don't think I'll be able solve it anytime soon.
Hope that there is anyone that can assist in resolving this issue. I think this is the final step to make Drupal truly multi-language enabled.
#20
instead I use Menu Block module. Similarly, now you have two blocks, but refers to the same menu (which are translated by other means). Each block shall be displayed to it's respective language.
http://drupal.org/node/438164#comment-1510084
#21
Agreed, menu translation is useless without being able to translate the menu title.
This really needs to be fixed! Subscribing.
#22
"The menu translation should be use for maintain just one menu structure with multiple translation." (deepkey #19)
I totally agree... anything else is just not scalable!
#23
Subscribing.
#24
Subscribing
#25
My solution:
create a template file specific for your menu (find the right filename using Theme developer by Devel module).
Hardcode the title you want to display in the template, wrapped in t('.....').
Example:
<h2 class="title"><?php print t('Title of my menu'); ?></h2>Then translate it with usual translation interface.
#26
Please see my patch. It only adds 1 line to i18nblocks.module.
diff -r 4fbfb5cf79df drupal6/sites/all/modules/i18n/i18nblocks/i18nblocks.module--- a/drupal6/sites/all/modules/i18n/i18nblocks/i18nblocks.module Wed Jul 08 20:06:25 2009 +0700
+++ b/drupal6/sites/all/modules/i18n/i18nblocks/i18nblocks.module Thu Jul 09 18:24:33 2009 +0700
@@ -331,6 +331,7 @@
// Replace menu blocks by their translated version.
if ($block->module == 'menu') {
$block->content = i18nmenu_translated_tree($block->delta);
+ $block->subject = tt("blocks:menu:$block->delta:title", $block->subject);
}
elseif ($block->module == 'user' && $block->delta == 1) {
$block->content = i18nmenu_translated_tree('navigation');
#27
Hello Leonth,
I tried your patch but it doesn't work on a menu. Is that expected? Does it work with blocks only?
Thanks.
#28
@ermannob: It only works on block titles. Specifically, only for titles of blocks created by menu.module.
Where is this "menu" (where it's not working) you are discussing?
#29
@Leonth: I have a menu which is populated by taxonomy_menu. Please note that it existed before applying your patch. Maybe your patch has effect on newly created menus only?
#30
@ermannob:
From my observation, once you view the block, the source string will appear on "translate interface" page and you can start translating. I don't really know about the inner workings of taxonomy menu so I can't comment more. I skimmed through taxonomy_term.module and I think it should be perfectly compatible... Have you tried with normal menu blocks?
#31
Shouldn't that be:
$block->subject = tt("blocks:menu:" . $block->delta . ":title", $block->subject);#32
I fixed and applied the patch from Lenoth, it works perfectly. Use patch from #26 and apply fix from #31
#33
The updated version of Lenoth's patch saved my day =)
At first I didn't find the string when I searched for it, but then all of a sudden it appeared. Not sure what I did. Could the cron job be involved in any way, seeing as it suddenly started working?
Thanks alot anyway
#34
Referring to #25, Can this be explained further please, with example. I'm not quite get it ... is it applicable for block translation such as "to translate the Language switcher block" http://drupal.org/node/367253?
#35
See #541048: Translate all custom block titles (not only custom blocks)
#36
I quickly patched i18nblocks and i18nmenu to make translation of menu block titles work. (This patch works for 6.x-1.4 as well as 6.x-1.x-dev).
#37
Works for me
#38
The patch looks ok, though it's incomplete. It doesn't handle the case where there's a custom title for the block.
Committed an improved version. Thanks.
#39
Thank you. :)
#40
Automatically closed -- issue fixed for 2 weeks with no activity.
#41
I JUST DON'T KNOW ANYMORE. I TRIED EVERYTHING AND THERE IS ALLWAYS A BUG. THERE ARE SOO MANY SITES WITH THIS FUNCTIONALITY. PLEASE PLEASE PLEASE POST A SIMPLE SOLLUTION TO THIS, OR DO A VIDEO. I'M NEW TO THIS AND INSTRUCTIONS LIKE INSTALL MODULE, CREATE NODE AND LINK TO MENU MEANS NOTHING. I TRIED INSTALLING THE I18N, INTERNATIONALIZATION, VIEWS, LOCALE, THERE IS ALLWAYS A PIECE MISSING IN THE PUZZLE. I'M SOOO TIRED OF THIS.................
IT SAIS INSTALL MODULE - I DO THIS, THEN GO THER i DO IT - BUT THERE IS NOTHING THERE, IT TAKES ME AN HOUR TO FIGURE OUT ITS A PERMISSIONS PROBLEM, THEN ANOTHER HOUR TO FIGURE OUT YOU HAVE TO LINK THIS WITH THAT. i CAN BE STUCK LIKE THIS FOREVER. ISN'T THERE A CLICK BY CLICK EXPLANATION HOW TO DO THIS, iTS ONLY (AND I'M PROBABLY INSULTING THE PROGRAMMERS HERE BUT..) CHANGING A TEXT OF A MENU WHEN I SELECT A DIFFERENT LANGUAGE, THE CONTENT CHANGES ALREADY.