Hi, I don't know if this is related to webform or i18n, so please bear with me.

I create a webform, then translate is successfully, with one exception. Here's my scenario: In my language both Ad and İsim translate to Name. I first create a webform with the Ad field, then when I try to translate that to Name, it becomes İsim, and this can (I think) be fixed by clearing the cache.

What can be done about this? Is this a bug, or am I doing something wrong?

Regards,

Comments

quicksketch’s picture

I'm not clear on where the "Name" field comes from here. Is that a field on the node/x/edit page or is it a field in the webform that you've created?

kartagis’s picture

It's a field on the webform that I've created.

quicksketch’s picture

Title: Wrong translation » Webform translates labels incorrectly
Category: support » bug

Okay looks like Webform is translating the component name improperly (in multiple ways). First, we're using the t() function here when we should probably be using i18n module's tt() function. Secondly, we're translating the label on components as part of node_load(), when we really should only be translating when displaying the label. Otherwise the translated version of the label may show up when you're editing the component.

sethiele’s picture

Version: 6.x-3.4 » 7.x-3.9
Status: Active » Needs review
StatusFileSize
new481 bytes

I submitted this patch already in #245424: Make Webform multilingual (i18n) aware through contributed modules
This patch adds two lines that let the Names (labels) of field translated in the backend.
For version 7.x-3.9

kartagis’s picture

Version: 7.x-3.9 » 6.x-3.9
Status: Needs review » Active

Hello,

I installed the 6.x-3.9 yesterday, and this problem persists.

kartagis’s picture

Status: Active » Needs review

My bad, I was looking at the wrong page. Changing to 'needs review' for #4.

quicksketch’s picture

I'm still not comfortable with this approach, just shoving labels through t() is not really the right solution here. In Drupal 6, I think we need to remove the t() from webform_node_load() as it shouldn't be there and causes confusing and potentially damaging behavior as described in the original post here.

If users want to take the cheap/incomplete route of just running labels through t(), they can override theme_webform_element() in Drupal 7, but this approach doesn't work in Drupal 6 because theme_webform_element() doesn't get used for displaying forms. I think we're best off spending the time needed to actually build in true translation support into Webform, but no one is actually interested in (and capable of) implementing it.

quicksketch’s picture

Status: Needs review » Fixed
StatusFileSize
new533 bytes

I posted a large master plan over in http://drupal.org/node/245424#comment-4873578, though as before I don't really have time/need to act on doing it the "right" way (nor does anyone else apparently).'

In any case, this patch fixes the "bug" but also removes functionality. As stated in the other issue, I really feel that the only true way to translate Webforms at this point is through multiple nodes, even though it's a huge hassle.

Status: Fixed » Closed (fixed)

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

anrikun’s picture

Version: 6.x-3.9 » 6.x-3.14
Status: Closed (fixed) » Active

No please revert this!
Updating to 6.x-3.14 broke my labels that don't get translated any more.
This t() should not be removed unless full i18n support is added.

quicksketch’s picture

@anrikun: I won't be adding it back as it's just outright *wrong* to translate the label like that. Not only is it incomplete (it doesn't translate descriptions, options, or any other strings), it actually can cause outright data corruption if people are editing Webform nodes in different languages.

anrikun’s picture

Version: 6.x-3.14 » 6.x-3.9
Status: Active » Closed (fixed)

All right. Thanks for your explanation.

tomsm’s picture

Sorry, but I had to revert the patch #8 because my labels were not translated anymore after upgrading to 6.x-3.14.
I hope i18n support will be completed soon...

hovel’s picture

I had to take action too. After upgrading to 6.x-3.14 on a live website labels were no longer translated.

I solved the issue(s) as follows:
In file webform.module, at the begin of function _webform_client_form_add_component
i place this statement $component['name'] = t($component['name']);.

This results in the labels being translated in the submit-form and result-view page but not on the webform edit page.

Maybe t() is not the proper way to do translation, but at the moment it is the only way.

Marcus Aurelius’s picture

@hovel: Thank you! You made my day!

giorgosk’s picture

#14 it seems in 6.x-3.17 its no longer possible
but apparently
reverting #8 works