-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n_menu_block_view_alter overrides custom block titles #101
Comments
I don't know if something like this makes sense:
I added this condition: |
Many thanks for reporting. We'll need to check all circumstances, of course, to prevent regressions. |
Weird enough... after some recherche and testing it appears to me, we can completely drop i18n_menu_block_view_alter() here. Module i18n_block has been dropped in B, as this functionality went into core. If I also skip this hook, block titles do stay translatable - still have to look closer into details. |
For sure this needs more testing, but I just provided a PR for discussion. 😏 Based on my findings, I dropped the (seemingly obsolete) block hook. |
I agree we can probably drop it. When I have a chance I'll test the pr with different settings. |
With this hook removed, then the only way (as far as I can see) to translate the menu block title is with the User Interface Translation: But then at least it respects custom block titles. It also means that this interface won't translate the block title, just the menu title for other contexts: Maybe some help text on that page? |
That might be because of the different concept in B re block translation. Blocks in general are pretty different (in Layout), so I'm not astounded, that things behave differently here. The interface provided by i18n does translate the menu title itself, but the block title gets handled by core (Layout). It could be that we need some further adaptions - not sure, where these changes should go to. |
I think your PR is good enough for now since it does fix the main bug. And deal with any UI improvements later, if needed. |
I'd like to - at least - add some help text, where this translation is relevant and what's not overridden (anymore). Otherwise it's too confusing. Especially, but not only for people coming from D7 - where this always translates the block title. Struggling a bit with wording, though. @herbdool any idea how to phrase that? |
So on this tab: Maybe something like:
|
@herbdool to me it seems, like you're in the same boat... 😃 The description is technically correct, but too wordy. |
A less wordy suggestion:
Linking to the translation page, instead of mentioning the path, would make the text even shorter. |
If someone sets a custom block title on a menu block, then
i18n_menu_block_view_alter()
ignores that custom title and assumes the title is same as the menu name and then changes it to that. See https://github.com/backdrop-contrib/i18n/blob/1fa318c320ea5e480dc27e9d13a0b07eea0d5f52/i18n_menu/i18n_menu.module#LL95C54-L95C54The function passes the textgroup and context for the menu title itself. For example,
menu:main-menu:title
. It should probably check the title somehow to see if the source title matches it.UPDATE: It also overrides core when it sets the title with
system_menu_block_set_title()
which will set the title to be menu item's parent.The text was updated successfully, but these errors were encountered: