The file field's description is passed through the 'file_upload_help' theme hook when its widget is added to a form. Depending on whether the form element's description equals to the original field's description after calling this theme hook, i18n_field may or may not replace the element's description with its translated version.
However, this approach might fail when a theme defines a "file_upload_help" theme hook that includes HTML with "id" attributes. An example is the Bootstrap theme with the popover enabled. It adds an "id" attribute and a "data-target" attribute pointing to it. As this "id" is generated by a drupal_html_id() call, its exact value changes every time the theme hook is used. This small change on the HTML, in turn, causes the comparison made by i18n_field to fail and the field's description to not be translated.
The code that implements this behavior can be found around the line 254 of the i18n_field.module file.
Comment | File | Size | Author |
---|---|---|---|
#2 | i18n_field-translate_desctriptions_with_bootstrap_popover.patch | 1.69 KB | genellann |
Comments
Comment #2
genellann CreditAttribution: genellann at On Fire Media commentedHere's a patch. I made it on version 1.26