Problem/Motivation
Now that Drupal 8 downloads real Drupal 8 translations following #1914070: Improve version fallback for install language., we can go and figure out translation problems. I found a big one right away with the "Extend" menu item. Looks like "Extend" is a word used elsewhere as "make it apply for a longer time" at least I assume that may be the case with the "Auto expire" module for example. Drupal 8 menu uses this as "add more components". This is an English word that is ambiguous for translation and would need context to disambiguate. Now the problem is menus / routing / tabs don't allow for such context to be specified.
The very concrete problem at hand is the Hungarian team translated "Extend" as the Hungarian equivalent of "lengthen" (ie. "extend my vacation", instead of "extend" as in "extend the system with more components"). I went to *fix* the translation, but given how wide this applies to, "fixing" it may as well brake it for other uses:
Mistranslation as appears in Drupal 8: 
Mistranslation as it appears on localize.drupal.org: 
Proposed resolution
1. Need way to attach context to strings in routing / tabs / contextual links and apply context to at least the string "Extend". As more ambiguous strings are found, apply context to those too. Covered by #2114069: Routing / tabs / actions lack way to attach context to UI strings.
2. Carry that over to the menu system. Covered by this patch.
Remaining tasks
- Figure out how to take over the context from routes/tabs/actions to the menu system.
User interface changes
None.
API changes
A way to carry on context for strings from routing / tabs / contextual links.
Related Issues
#2114069: Routing / tabs / actions lack way to attach context to UI strings provides the data to use.
Comments
Comment #1
gábor hojtsyPostponing on #2114069: Routing / tabs / actions lack way to attach context to UI strings.
Comment #2
yesct commented#2114069: Routing / tabs / actions lack way to attach context to UI strings is in.
Comment #3
andypostI think the issue should be a part of meta to figure out a primary context names, the same as we use for query and cache tags
Contexts are used in filter form for translation so better to keep the list a short as possible
So for menu items we could apply 'Menu title' context - otoh #2114069: Routing / tabs / actions lack way to attach context to UI strings did a 'With components' for single menu item
Comment #4
gábor hojtsy@andypost: I don't think you want to translate "Edit" separate for when it is a menu item or button label or tab or contextual link. I don't think the use of place of the text is relevant for translation context. 'Extend' as a menu item or 'Views' as a menu item can still mean many different things. Eg if you have a service with a subscriptions menu with an 'Extend' item, that would mean "Extend time of my subscription" or "Extend with modules" as in the Drupal menu. Wholesale contexting like "Menu item" does not really help provide context.
Comment #5
gábor hojtsyThis is postponed on menu changes I think, namely #2256497: [meta] Menu Links - New Plan for the Homestretch.
Comment #6
gábor hojtsyAdded support for title_context extraction to the extractor patch at #2254561: Support string extraction for Drupal 8 menu_links.yml with anticipation this would use the same API as local tasks, contextual links and actions. I think that is a fair assumption.
Comment #7
gábor hojtsyLooks like this has been independently resolved in the menu refactoring. MenuLinkManager::$defaults has this:
Comment #8
gábor hojtsyAlso updated docs at https://www.drupal.org/node/2122241, added this para: