Contact categories can't be translated with i18n

hunvreus - April 26, 2008 - 06:23
Project:Drupal
Version:7.x-dev
Component:contact.module
Category:bug report
Priority:normal
Assigned:Dave Reid
Status:needs work
Issue tags:needs backport to D6
Description

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).

AttachmentSizeStatusTest resultOperations
contact_i18n_t.patch604 bytesIdleFailed: Failed to apply patch.View details | Re-test
contact_i18n_variable.patch9.69 KBIdleFailed: Failed to apply patch.View details | Re-test

#1

searosin - March 14, 2009 - 02:45

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

#2

vthirteen - August 3, 2009 - 18:52

subscribe

#3

Dave Reid - August 23, 2009 - 14:37
Version:5.7» 7.x-dev

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

#4

castawaybcn - September 4, 2009 - 08:21

subscribe

#5

Dave Reid - October 8, 2009 - 16:41

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.

#6

Dave Reid - October 8, 2009 - 16:44
Status:needs work» needs review

Patch attached for review.

AttachmentSizeStatusTest resultOperations
251482-contact-category-translate-D7.patch1.58 KBIdleFailed: Failed to apply patch.View details | Re-test

#7

Dave Reid - October 8, 2009 - 16:50
Assigned to:Anonymous» Dave Reid

#8

Dave Reid - October 8, 2009 - 17:25
Category:feature request» bug report

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.

#9

Dave Reid - October 9, 2009 - 03:12

Rerolled for latest changes.

AttachmentSizeStatusTest resultOperations
251482-contact-category-translate-D7.patch1.6 KBIdlePassed: 13709 passes, 0 fails, 0 exceptionsView details | Re-test

#10

andypost - October 11, 2009 - 06:15

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.

AttachmentSizeStatusTest resultOperations
251482-contact-category-translate-D7.patch1.42 KBIdlePassed: 13694 passes, 0 fails, 0 exceptionsView details | Re-test

#11

Dave Reid - October 11, 2009 - 14:32

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

#12

Dave Reid - October 11, 2009 - 16:02
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.

#13

sun - October 12, 2009 - 21:22
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.

#14

Dave Reid - October 12, 2009 - 21:30

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

#15

sun - October 12, 2009 - 21:39

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? ;)

#16

andypost - October 12, 2009 - 22:24

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

AttachmentSizeStatusTest resultOperations
593746_contact.patch3.42 KBIgnoredNoneNone
 
 

Drupal is a registered trademark of Dries Buytaert.