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).
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| contact_i18n_t.patch | 604 bytes | Idle | Failed: Failed to apply patch. | View details | Re-test |
| contact_i18n_variable.patch | 9.69 KB | Idle | Failed: Failed to apply patch. | View details | Re-test |

#1
Could you make these patches (or a module that works like the patches) for D6? It would be very useful.
#2
subscribe
#3
Feature requests are only accepted in HEAD. Any bugfixes must also be fixed in HEAD first, then backported.
#4
subscribe
#5
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
Patch attached for review.
#7
#8
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
Rerolled for latest changes.
#10
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.
#11
We shouldn't have to explicitly say that something is translatable. Most users should assume that any kind of string is.
#12
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
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
@sun: This approach is consistently used throughout core. See http://localize.drupal.org/translate/projects/drupal/warnings
#15
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
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