Fields and descriptions of profile.module are not translatable. this is a patch that try to do this.

CommentFileSizeAuthor
profile.module_0.diff2.48 KBpietro

Comments

Stefan Nagtegaal’s picture

We do not make user submitted data translatable. The locales-table would be filled up with junk..
I'm leaving setting this to 'By design' to anybody else..

pietro’s picture

this patch isn't to translate user submitted data, but the field names and description.

chx’s picture

Project: Drupal core » Internationalization
Version: 4.6.3 » 4.6.x-1.x-dev
Component: profile.module » User interface
Priority: Critical » Normal
jose reyero’s picture

Status: Needs review » Needs work

> this patch isn't to translate user submitted data, but the field names and description.

Well, it's web configurable content so I wouldn't support this patch either to be applied to core.

But anyway, the patch is here for anyone who wants to apply it.

mgifford’s picture

1) You're not talking much more than about 20 strings, so relax about polluting the translation array.

2) If not this way, then how? There's got to be some way to use this module in a multi-lingual environment. If using the translation array isn't they way then is there openness in the community to re-write the module for some other way? If not consider the patch.

3) I think this code is cleaner.


206c209
<         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));
248c251
<       $title = ($field->type != 'checkbox') ? check_plain($field->title) : '';---
>       $title = ($field->type != 'checkbox') ? check_plain(t($field->title)) : '';
257c260
<   $output = $field->explanation;
---
>   $output = t($field->explanation);
282c285,289
<     $category = $field->category;
---
> 
>     // Make admin generated categories/titles translatable   
>     $category = t($field->category);
>     $field->title = t($field->title);
> 
302c309
<             $options[$line] = $line;
---
>             $options[$line] = t($line);  

Sorry it's not a patch

jose reyero’s picture

Title: add i18n to profile.module » Profile translation: add i18n to profile.module
Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev

Just reorganizing pending issues.

milksamsa’s picture

Got news on this patch? I really need to translate the fields in profile page.

druvision’s picture

Me too. i18n for user-defined data (vocabulary names, profile field names, CCK field names) is a whole issue which I am seeking a general good solution to.

Amnon
Personal: Bring Dolphin's Simple Joy to your Work - Job - Career
Professional: Drupal Hebrew Consulting

jose reyero’s picture

Assigned: Unassigned » jose reyero
Status: Needs work » Fixed

Please give a try to this new module I've committed to i18n-HEAD. You can check it out from cvs or try these links (module and install file)

http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/i1...
http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/i1...

It adds a tab to admin/settings/profile to translate all category names and field names and descriptions. No patches needed.

Feedback is welcomed.

milksamsa’s picture

Dear Jose,
the module seems to work fine in profile viewing.
During the sign up though, the original language fields are shown. Is it possible to display the translation also during sign up?

jose reyero’s picture

Yes, it is.
Just fixed that. Try the latest.

Btw. Known issue: Both translated and untranslated fields show up in the user account main page

milksamsa’s picture

I've been trying to download from the above links but it didn't work. I even reinstalled the module by using the Devel module. No chance.
What am I doing wrong?

I still display the info in "translated" language after logging in, but no translated fields are shown when in sign-up mode.

Anonymous’s picture

Status: Fixed » Closed (fixed)
mimamim’s picture

Hi! I'm using Drupal 6.8 and experience the same problem. Luckily, your fix also fits 6.x, only the line numbers are a little different.

What I added to your fix is changing in file profile.pages.inc, function profile_browse(), in my case it's line 71:

From:

    if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'textfield') {
      $title = strtr(check_plain($field->page), array('%value' => theme('placeholder', $value)));
    }

To:

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

This changes the titles of pages for the groups of users with similar answers, f.e. "Users who like %value color"

mimamim’s picture

Yet another fix. I created category "Personal information" and the category name is not translated on edit page.

Fix (file profile.module, function profile_categories(), line 457):

from:

      'name' => $category->category,
      'title' => $category->category,

to:

      'name' => $category->category,
      'title' => t($category->category),

don't forget to clear cache after changing

Mr P’s picture

Can't get category name translation to work properly. Please take a look at my comments here: http://drupal.org/node/376182