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)));
    }
CommentFileSizeAuthor
#6 profile.gif8.09 KBMr P
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mimamim’s picture

file profile.module, function profile_view_field($user, $field), line 262

      case 'textfield':
      case 'selection':
        return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);

->

      case 'textfield':
        return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
      case 'selection':
        return $browse ? l(t($value), 'profile/'. $field->name .'/'. $value) : check_plain(t($value));
mimamim’s picture

profile.module, function profile_view_profile(&$user), line 318

          '#title' => $field->category,

->

          '#title' => t($field->category),
Junro’s picture

Thanks :)

They should add this in the next drupal release...

Junro’s picture

erf line number are not exactly the same in my version, for exemple line 264 :

return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);

I'm not expert in php, I prefer to wait... hopping it will come soon :)

Junro’s picture

Perfect! Looks to work fine! Thanks :)

Mr P’s picture

FileSize
8.09 KB

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

Mr P’s picture

Yes - 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?

Mr P’s picture

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

Junro’s picture

You should realy have english as default language, trust me on that!

Mr P’s picture

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

Mr P’s picture

Here'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!

saipas’s picture

Hey,

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:

    if (!isset($fields[$category])) {
      $fields[$category] = array('#type' => 'fieldset', '#title' => check_plain($category), '#weight' => $weight++);
    }
    switch ($field->type) {
      case 'textfield':
      case 'url':

New:

    if (!isset($fields[$category])) {
      $fields[$category] = array('#type' => 'fieldset', '#title' => check_plain($category), '#weight' => $weight++);
    }
    $field->title = t($field->title);
    switch ($field->type) {
      case 'textfield':
      	$fields[$category][$field->name]['#title'] = $field->title;
      case 'url':
kento’s picture

There'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.

just_like_good_vibes’s picture

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

thiagomp’s picture

Status: Needs review » Closed (works as designed)

Based on Kenko's comment (#13) this bug can be closed.