Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi Guys
When using this widget, the label in the forms doesn't show up translated, it always shows up as the original label.
Cheers
Comments
Comment #1
mradcliffeDoes this duplicate #1960648: Label using t() for printing, should use check_plain() with the fix in that issue, or is it just a a related issue?
Comment #2
jm.federico CreditAttribution: jm.federico commentedHi
Related, used the same title by mistake. This so that lable gets translated when needed.
The other one was because it was being printed incorrectly.
Problem here is that when using i18n_field, one can translate fields labels, but this fields label doesn't get translated.
To reproduce:
Comment #3
mradcliffeHmm, I'm not sure if I can fix this in my module. I do see some issues in i18n that have patches that may help if they were modified.
#1964234: Not all fields are translated
#1904368: [7.x-1.8 regression] Field translation fails in numerous situations
The issue is that the widget_form_alter() is only looking for #title property on the initial form element. There are some patches to look at a form element child at index 0, but it would be better if the patch used element_children(). I think if that were the case, then it would translate.
Comment #4
mradcliffeYeah, a quick hack to i18n_field_widget_form_alter() confirms that approach does work.
Comment #5
mradcliffeI cannot support this at the moment due to incompatibility with i18n module. As soon as i18n module fixes its implementation, then this will work for complex fields.