The contact module stores all the contact categories in a separate table and do not use the t() function for displaying these, which means there is no way to translate the labels. I have two patches doing two different things:

- contact_i18n_t.patch ; use the t() function when displaying categories labels, these can then be translated through the locale module.

- contact_i18n_variable.patch ; store categories in a variable, thus enabling to set it as an i18n variable (in settings.php). This may be interesting to allow different email addresses for different languages (inquiry@company.com for the English version and inquiry@company.cn for the Chinese version for example).

Comments

searosin’s picture

Could you make these patches (or a module that works like the patches) for D6? It would be very useful.

vthirteen’s picture

subscribe

dave reid’s picture

Version: 5.7 » 7.x-dev

Feature requests are only accepted in HEAD. Any bugfixes must also be fixed in HEAD first, then backported.

castawaybcn’s picture

subscribe

dave reid’s picture

Issue tags: +Needs backport to D6

I much prefer just using t() rather than dropping the whole table to use variables. Drupal core already uses t() with non-strings quite often (see http://localize.drupal.org/translate/projects/drupal/warnings).

Since this doesn't break existing translations, we should backport this to D6.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new1.58 KB

Patch attached for review.

dave reid’s picture

Assigned: Unassigned » dave reid
dave reid’s picture

Category: feature » bug

I'd classify this as a bug report since this doesn't work properly without the patch and there's no way to override the strings.

dave reid’s picture

Rerolled for latest changes.

andypost’s picture

StatusFileSize
new1.42 KB

Tested with russian language, little bit confused after entering russian category I found it's string at admin/config/regional/translate/translate

Reroll for current state, suppose there's should be a help text to point a user to write a category's name in english and then translate them at admin/config/regional/translate/translate
Maybe this should be displayed only if locale module enabled.

dave reid’s picture

We shouldn't have to explicitly say that something is translatable. Most users should assume that any kind of string is.

dave reid’s picture

Status: Needs review » Reviewed & tested by the community

Test this with a dummy contact.fr.po and it translated in both the site-wide contact form and the admin/structure/contact interface.

sun’s picture

Status: Reviewed & tested by the community » Needs work

Please note that #593746: Prepare Drupal core for dynamic data translation intends to make all of such loaded data throughout Drupal core translatable.

The approach taken here won't fly. t() must not be used on user-defined strings.

dave reid’s picture

@sun: This approach is consistently used throughout core. See http://localize.drupal.org/translate/projects/drupal/warnings

sun’s picture

uhm, you want to get approval for this patch by pointing to a page that lists warnings for improper usage of t() throughout Drupal core? ;)

andypost’s picture

StatusFileSize
new3.42 KB

I make a patch to prepare http://drupal.org/node/593746#comment-2142776

@sun are you really sure that we could see in core #593746: Prepare Drupal core for dynamic data translation

This approach is great so i18n can translate the contact categories on-fly by rewriting queries, so I think that we should go with DBTNG

@Dave anyway i18n can translate categories if queries are completely overridable

dave reid’s picture

Please upload a patch that can be run by the testbot (make sure it ends in 'd7.patch'.

andypost’s picture

Status: Needs work » Needs review

Maybe just to change status...

andypost’s picture

StatusFileSize
new2.42 KB

Some parts of patch already in, so changed a bit.

sun’s picture

+++ modules/contact/contact.admin.inc	17 Feb 2010 20:48:22 -0000
@@ -19,7 +19,14 @@ function contact_category_list() {
+    ->addTag('contact')

+++ modules/contact/contact.module	17 Feb 2010 20:48:23 -0000
@@ -159,7 +159,13 @@ function _contact_personal_tab_access(st
+    ->addTag('contact')

+++ modules/contact/contact.pages.inc	17 Feb 2010 20:48:23 -0000
@@ -27,6 +27,7 @@ function contact_site_form($form, &$form
+    ->addTag('contact')

I don't think that this tag makes any sense. Why did you add it?

Powered by Dreditor.

andypost’s picture

@sun this tag is helpful for i18n to identify a query

sun’s picture

No, that's the 'translatable' tag ;)

andypost’s picture

@sun Are you sure to remove this tags? They looks same as
http://api.drupal.org/api/function/_block_load_blocks/7

->addTag('block_load')

EDIT: You raise this at #46 #593746: Prepare Drupal core for dynamic data translation

andypost’s picture

StatusFileSize
new1.69 KB

So here is a patch without this tag

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks.

ddorian’s picture

bump :)

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

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

moonray’s picture

Version: 7.x-dev » 6.x-dev
Status: Closed (fixed) » Patch (to be ported)

Can we backport this fix to D6?

sun’s picture

Version: 6.x-dev » 7.x-dev
Status: Patch (to be ported) » Closed (fixed)
Issue tags: -Needs backport to D6

No, there is nothing to backport here.

ddorian’s picture

moonray there is multilingual contact form module for drupal6
just search for it

generalelektrix’s picture

I searched for it, only found tContact which does not help translating categories additionnal informations. I also tried with L10n without more luck. If someone has an easy solution, I'm a taker!

gábor hojtsy’s picture

For anybody looking for a solution, i18n_contact is in the Drupal 7 development version of the i18n module now, it translates contact categories, emails and autoreplies for you.