I think the YouTube field is not translating correctly.

Here is what I am doing:

(1) install a brand new Drupal site, for example using drush qd -y

(2) download and enable i18n_field and youtube

drush dl i18n variable youtube
drush en i18n_field youtube -y

(3) log into your site (for example using drush uli), go to admin/config/regional/language and enable French as a new language

(4) go to admin/config/regional/language/configure and set "URL" as a detection mechanism

(5) go to admin/config/people/accounts/fields and add a youtube field called "English Field Title" (machine name: field_english_field_title); add also a text field called "English Field Title (not youtube)" (machine name: field_english_field_title_not_yo)

(6) go to admin/config/people/accounts/fields/field_english_field_title/translate/fr and set the label to "French Field Title"

(7) go to admin/config/people/accounts/fields/field_english_field_title_not_yo/translate/fr and set the label to "French Field Title (not youtube)"

(8) go to fr/user/1/edit, and you will see "French Field Title (not youtube)", but, for the Youtube field, instead of "French Field Title", you will see "English Field Title"

Cheers,

Albert.

Comments

alberto56’s picture

Issue summary: View changes
ZikPhil’s picture

Status: Active » Needs review
StatusFileSize
new462 bytes

The issue seems to be that there is a t function missing in the hook_field_widget_form that is preventing the title to look for translated content.

I just added that line before the field element is saved :

$element['#title'] = t($instance['label']);

So far no issues :)

Cheers!

ZikPhil’s picture

The previous patch was against the current dev version, this is for the current 1.2 version.

Edit: Woops, they are both identical. No clues why the previous one didnt worked.

ZikPhil’s picture

StatusFileSize
new462 bytes

Ok guys hang with me, that also includes the description.

  $element['#description'] = t($element['#description']);

  $element['#title'] = t($instance['label']);

Cheers.

ZikPhil’s picture

StatusFileSize
new524 bytes
alberto56’s picture

guschilds’s picture

Hey all,

Thanks for bringing this up, for such detailed steps to reproduce, and for the patches. The patches in #2 and #3 were identical because 1.2 and the 7.x-1.x branch are currently the same. Those patches, however, didn't seem to solve the problem for me.

After looking at how a few common modules implement hook_field_widget_form(), I came to realize that this module's implementation was a bit off. After correcting it to be more in line with those I was looking at, the translations for both title and description began working.

Please give the attached patch a try on the 7.x-1.2 release by following the steps in the issue's description. Translations for both title and description should now work.

Thanks again,
Gus

  • guschilds committed 2ba854e on
    Issue #2229871 by ZikPhil, alberto56, guschilds: Fixed building of...
guschilds’s picture

Status: Needs review » Fixed

I have committed the fix from #7 to the 7.x-1.x branch. It will be available in the next release. I will also be creating a new issue to ensure this is not a bug in the 8.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.