Tooltips should be exported with a t() function like other Views labels.

Comments

infojunkie’s picture

Version: » 7.x-1.x-dev

Added tooltip translatability, but dependent on #2290511: `unpack_translatable` not supported for display extenders to export translatable strings.

infojunkie’s picture

Status: Active » Postponed
Parent issue: » #2290511: `unpack_translatable` not supported for display extenders
infojunkie’s picture

Project: Views Label Tooltip » Views Field Tooltip
tanius’s picture

I applied the patch for the parent issue #2290511: `unpack_translatable` not supported for display extenders, and use patch in this issue (or more precisely, the functional equivalent now contained in the current 7.x-1.x-dev version). And it seems this implementation is saving translatable strings with the correct context, but trying to look them up with an empty context, which fails. (Not sure if this is how the Drupal string translation system works internally, it's just how it appeared to me …)

In detail:

  1. When only applying the patch provided in this issue, tooltip label translation works fine (I did not try translation for field tooltips though). However, the strings to translate will appear in the Drupal "Translate interface" system (/admin/config/regional/translate/translate) with text group "Built-in Interface" and an empty value for context.
  2. This is what the patch in parent issue #2290511: `unpack_translatable` not supported for display extenders is meant to fix. After applying it, the strings will register with text group "Views" and context values like my_view_name:my_display_name:field_my_field_name:label_tooltip:text in the "Translate interface" system.
  3. However, when rendering the tooltips, the translations are not taken from these new places, but still from the old places (if these translations were created before applying the parent issue patch) resp. are not found at all (if no fitting translations with text group "Built-in Interface" and empty context exist). So it seems the lookup of translations is incomplete in this implementations?

As a workaround, just don't apply the parent issue patch for now. This will not allow translating the same string differently in different places since the context is empty, but if that is not needed, it will work for now. One more hints for getting this workaround to work: the strings in text group "Built-in interface" will only appear in the "Translate interface" backend after you visited a non-English page on your site's frontend where the translated tooltip ought to appear. Visiting an English frontend page will not help, as no translation of the built-in interface is attempted there (it is assumed the built-in interface is always English in Drupal, independent of the default language you set).