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
Comment #1
searosin commentedCould you make these patches (or a module that works like the patches) for D6? It would be very useful.
Comment #2
vthirteen commentedsubscribe
Comment #3
dave reidFeature requests are only accepted in HEAD. Any bugfixes must also be fixed in HEAD first, then backported.
Comment #4
castawaybcn commentedsubscribe
Comment #5
dave reidI 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.
Comment #6
dave reidPatch attached for review.
Comment #7
dave reidComment #8
dave reidI'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.
Comment #9
dave reidRerolled for latest changes.
Comment #10
andypostTested 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.
Comment #11
dave reidWe shouldn't have to explicitly say that something is translatable. Most users should assume that any kind of string is.
Comment #12
dave reidTest this with a dummy contact.fr.po and it translated in both the site-wide contact form and the admin/structure/contact interface.
Comment #13
sunPlease 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.
Comment #14
dave reid@sun: This approach is consistently used throughout core. See http://localize.drupal.org/translate/projects/drupal/warnings
Comment #15
sunuhm, you want to get approval for this patch by pointing to a page that lists warnings for improper usage of t() throughout Drupal core? ;)
Comment #16
andypostI 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
Comment #17
dave reidPlease upload a patch that can be run by the testbot (make sure it ends in 'd7.patch'.
Comment #18
andypostMaybe just to change status...
Comment #19
andypostSome parts of patch already in, so changed a bit.
Comment #20
sunI don't think that this tag makes any sense. Why did you add it?
Powered by Dreditor.
Comment #21
andypost@sun this tag is helpful for i18n to identify a query
Comment #22
sunNo, that's the 'translatable' tag ;)
Comment #23
andypost@sun Are you sure to remove this tags? They looks same as
http://api.drupal.org/api/function/_block_load_blocks/7
EDIT: You raise this at #46 #593746: Prepare Drupal core for dynamic data translation
Comment #24
andypostSo here is a patch without this tag
Comment #25
sunThanks.
Comment #26
ddorian commentedbump :)
Comment #27
dries commentedCommitted to CVS HEAD. Thanks.
Comment #29
moonray commentedCan we backport this fix to D6?
Comment #30
sunNo, there is nothing to backport here.
Comment #31
ddorian commentedmoonray there is multilingual contact form module for drupal6
just search for it
Comment #32
generalelektrix commentedI 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!
Comment #33
gábor hojtsyFor 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.