Я создаю многоязычный сайт с использованием профилей пользователей. К сожалению, drupal забыл включить поддержку переводов в поля профилей, название категорий, значения в выпадающих списках. Пришлось патчить. Делюсь с общественностью, поскольку найти такой полный патч в интернете не удалось. Я создала issue на drupal.org: http://drupal.org/node/376182
Номера строк даны для drupal 6.8, но похоже, что для предыдущих версий изменения абсолютно аналогичные.
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] = 
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)));
    
} 
 
   
  
Комментарии
file profile.module, function profile_view_field($user, $field), line 262
case 'selection':
return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value);
->
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));
profile.module, function profile_view_profile(&$user), line 318
->
А что потом? Создавать *.po файл с переводом или оно будет видеть данные значения при переводе интерфейса в админке? Для 7.х это тоже пойдёт?!
в i18n есть Profile translation, но как сделать чтобы он заработал?