Hello,
nice module! I'm using it to add a custom error message.

However the message does not appear as a string in Translate interface.
I have the i18n and String translation modules installed.

Thank you!

Comments

quasi’s picture

Any thoughts on this?

Thank you!

liam morland’s picture

Error messages defined in the module are run through the t() function for translation. If you are using the module's hooks to create validators in your own module, you would have to call t() yourself.

I haven't done much with translation. Is something else needed to make it work with the i18nstrings module?

quasi’s picture

Hey Liam,

thank you for your answer!

If I insert an error message through the interface it doesn't come up as a translatable string,
however if I insert it in a hook it does.

Thanks!

liam morland’s picture

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

It sounds like Webform Validation needs a patch that would pass the error messages through t().

Khetam’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new927 bytes

Here's the patch......
Please check it.

Thanks,
Kito.

Khetam’s picture

liam morland’s picture

Thanks very much.

Can someone else who uses i18nstrings module please check that this patch works? If it does, please set the issue status to RTBC. Thanks.

paypaul’s picture

This patch didn't fix the translation of custom error messages for me. I did figure out a solution though. It seems like all of the translation stuff for the module is targeted at Drupal 6. The name of the Internationalization module under Drupal 7 is different. Also the API for the module has changed quite a bit. I added hook_i18n_string_info() to define a textgroup for Webform Validation and changed some i18n calls in a few places and now string translation is working great for me under Drupal 7. I will submit a patch shortly.

paypaul’s picture

StatusFileSize
new2.21 KB

Here is the patch. Thanks.

liam morland’s picture

Thanks very much. Is there anyone else who can test this?

liam morland’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Khetam’s picture

Status: Closed (fixed) » Patch (to be ported)
StatusFileSize
new2.13 KB

I changed small thing and the patch worked fine.

liam morland’s picture

@Khetam: Please explain what your patch is for. "Patch (to be ported)" is used to mark issues that have a patch which needs to be ported to another version of the module. Marking items "Patch (to be ported)" should be accompanied by changing the version number to the version which needs the patch. Once the patch is ready, the status should be "Needs review".

liam morland’s picture

Status: Patch (to be ported) » Postponed (maintainer needs more info)
Khetam’s picture

When i tried the old patch it was not showing any webform error messages or translating them so i remove this line of code return i18n_string('webform_validation:error_message:' . $rule['ruleid'] . ':message', $rule['error_message']);

and added this line t($rule['error_message']) , The messages start appearing on the translated string tab.

Thanks.

Khetam’s picture

Status: Postponed (maintainer needs more info) » Needs review
liam morland’s picture

Status: Needs review » Closed (fixed)

Your patch does not apply to the latest development version of Webform Validation; it needs work.

What is module_exists('i18n') for? t() doesn't require i18n module to be installed.

It looks like what you are trying to do is remove the support for the i18n module. That may be a worthwhile goal; I don't know enough about translation to know that. If that is the case, that needs to be done in a separate issue. Setting status back to what it was.