Unfortunately, user profile module doesn't looks for translations for field names, list values, category names. This is my patch. Line numbers taken from version 6.8, but it looks like that this patch can be applied also to earlier versions.
File profile.module
function profile_view_field($user, $field), line 264
return $browse ? l($field->title, "profile/$field->name") : check_plain($field->title);
->
return $browse ? l(t($field->title), "profile/$field->name") : check_plain(t($field->title));
function profile_view_profile(&$user), line 312
$title = ($field->type != 'checkbox') ? check_plain($field->title) : NULL;
->
$title = ($field->type != 'checkbox') ? check_plain(t($field->title)) : NULL;
function _profile_form_explanation($field), line 334
$output = $field->explanation;
->
$output = t($field->explanation);
function profile_form_profile($edit, $user, $category, $register = FALSE), line 352
$category = $field->category;
->
$category = t($field->category);
$field->title = t($field->title);
line 399
$options[$line] = $line;
->
$options[$line] = t($line);
function profile_categories(), line 457
'title' => $category->category,
->
'title' => t($category->category),
file profile.pages.inc, function profile_browse(), line 71:
if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'textfield') {
$title = strtr(check_plain($field->page), array('%value' => theme('placeholder', $value)));
}
->
if ($field->type == 'selection') {
$title = strtr(check_plain(t($field->page)), array('%value' => theme('placeholder', t($value))));
}
else if ($field->type == 'list' || $field->type == 'textfield') {
$title = strtr(check_plain(t($field->page)), array('%value' => theme('placeholder', $value)));
}
Comment | File | Size | Author |
---|---|---|---|
#6 | profile.gif | 8.09 KB | Mr P |
Comments
Comment #1
mimamim CreditAttribution: mimamim commentedfile profile.module, function profile_view_field($user, $field), line 262
->
Comment #2
mimamim CreditAttribution: mimamim commentedprofile.module, function profile_view_profile(&$user), line 318
->
Comment #3
Junro CreditAttribution: Junro commentedThanks :)
They should add this in the next drupal release...
Comment #4
Junro CreditAttribution: Junro commentederf line number are not exactly the same in my version, for exemple line 264 :
I'm not expert in php, I prefer to wait... hopping it will come soon :)
Comment #5
Junro CreditAttribution: Junro commentedPerfect! Looks to work fine! Thanks :)
Comment #6
Mr P CreditAttribution: Mr P commentedThanks for this. All seems to works - except for the links/buttons under: My Account/Edit Eg, 'Personal Information', 'My Newsletter'...'Account' is the only one that does translate.
Somehow, while messing with Refresh on the Translate Interface and Clear Cache with Devel, I managed to get them all to translate (to French) but then they stuck and wouldn't translate to English! I got them back again after more messing about - but can't make this happen again.
Any help appreciated.
Comment #7
Mr P CreditAttribution: Mr P commentedYes - if I clear the cache while in English - they remain stuck in English after switching to French - and when I clear the cache in French then they stick in French after switching to English. Odd!
I used the String Overrides module to translate the text - that the right way?
Comment #8
Mr P CreditAttribution: Mr P commentedNow I've got the categories to translate - but only if I have the sites default language set to English. My sites default needs to be French. Thought the problem might be similar to the Content Types one - http://drupal.org/node/228610 - but that fix doesn't work for this problem. (It's not supposed to be a good idea to keep changing your sites default language anyway.)
Comment #9
Junro CreditAttribution: Junro commentedYou should realy have english as default language, trust me on that!
Comment #10
Mr P CreditAttribution: Mr P commentedBut if I do, visitors (who will mostly be French) get the front page in En. Can't find away around that apart from setting the default language to Fr.
Comment #11
Mr P CreditAttribution: Mr P commentedHere's some more links relating to this problem:
User category (submenu in the user profile) is not translatable - http://drupal.org/node/367323
Profile module translation and selection type "addon" - http://drupal.org/node/400396
Help with this problem appreciated!
Comment #12
saipas CreditAttribution: saipas commentedHey,
I had the same issue and just needed the user profile form to be translated (user register form is already translated correctly). In Drupal 6.15, I made the following changes line 352 to profile.module (function profile_form_profile):
Existing:
New:
Comment #13
kento CreditAttribution: kento commentedThere's no need to alter core code (which isn't recommendable anyway), if you use the i18n module (http://drupal.org/project/i18n) which includes the Profile Translation module. Just enable it and go ahead translate all your profile fields ... you can find them e.g. using admin/build/translate/search where you'll see a new Profile option under the Limit search to: section.
Comment #14
just_like_good_vibesthank you very much!
i've been looking rapidly at README.txt & online docs of i18n module, googling to find a solution for this problem of translating profile fields with i18n, and i didn't found it easily (i mean not in a few seconds on the first search results). I found your solution after a couple of "deprecated" ones, therefore i add this comment with keywords inside to help google find this post because i believe this is a common issue when you haven't done it at least 1 time :)
"translating profile fields with i18n" -> enable "Profile Translation" module provided by i18n module.
Comment #15
thiagomp CreditAttribution: thiagomp commentedBased on Kenko's comment (#13) this bug can be closed.