Hi, I'm using the Contact module and I need to use it in three different languages. My problem is that I can't translate the title of the resulting form in any way. The title is "Contact" but I need to internationalizate it. Is this a bug or I haven't found the way?

CommentFileSizeAuthor
#3 contact_module.patch1.26 KBjmlavarenne

Comments

enkara’s picture

Nobody else has had this problem? At least tell me if it's my fault. Thank you!

jmlavarenne’s picture

Version: 5.2 » 5.11
Priority: Normal » Critical

I have the same problem, and I've been looking through the site for a good hour for solutions. It seems a few people have the same issue. Some have been able to fix it with i18l and adding variables to settings.php, but I find it harsh to install a module just to translate this one string.

contact.module line 431

I changed


    $form['contact_information'] = array('#value' => filter_xss_admin(variable_get('contact_form_information', t('You can leave a message using the contact form below.'))));

to


$form['contact_information'] = array('#value' => t(filter_xss_admin(variable_get('contact_form_information', 'You can leave a message using the contact form below.'))));

The part within the t() function seems to not get translated when it is within the variable_get() call.

jmlavarenne’s picture

Version: 5.12 » 5.11
Category: bug » support
Priority: Normal » Critical
StatusFileSize
new1.26 KB

I've quickly put together a patch with WinMerge - hope it's good. I've also edited line 281 to have the t() function do it's work on the returned value of variables_get(). It's against 5.12.

jmlavarenne’s picture

Category: support » bug
Priority: Critical » Normal
jmlavarenne’s picture

Version: 5.11 » 5.12
jmlavarenne’s picture

Version: 5.11 » 5.12
Category: support » bug
Priority: Critical » Normal
Status: Active » Needs review
gábor hojtsy’s picture

Status: Needs review » Closed (works as designed)

User provided strings are not translated in Drupal by design. Use the http://drupal.org/project/stringoverrides module for a simple solution. You don't need the whole i18n stack for this.

bloke_zero’s picture

Yes, but Drupal 6 doesn't seem to be running that bit through t() unless I'm missing somthing.