"Title" and "Body" labels are not translated, then translated wrong

mbria - June 4, 2007 - 23:05
Project:Internationalization
Version:6.x-1.0-beta4
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm quite sure I'm missing something, but I'm not able to translate "Title" and "Body" fields although now could be defined by user.

I'm on a drupal 5.1 with i18n but as far as are interface strings I thought it need to be done by locale...

I dig into the code and I found that they are defined without t(). In node.module around line 2957 you can see:

    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => check_plain($type->title_label),
      '#required' => TRUE,
      '#default_value' => $node->title,
      '#weight' => -5,
    );

Is it right? or need to be translated as...

    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t(check_plain($type->title_label)),
      '#required' => TRUE,
      '#default_value' => $node->title,
      '#weight' => -5,
    );

Same happens with body, that I changed for:

      '#title' => t(check_plain($type->body_label)),

I did the change and I didn't noticed any collateral effects.

Sorry in advance for the annoyance if it's not a bug and it's just my ignorance.

Cheers,

m.

#1

flk - June 5, 2007 - 12:30
Version:5.1» 6.x-dev

since your able to define both title and body shouldn't you be defining them in the chosen language?

any way's, you cant change anything in a stable version...

btw in future you should create a patch for the problem in this format attached. (either use diff or something like tortoiseCVS)

AttachmentSize
translate_node_fields.patch 919 bytes

#2

mbria - June 7, 2007 - 19:40

No problem with attaching a patch. I will do next time... but I was unsure about if it really was an issue. Thanks to fix it.

> since your able to define both title and body shouldn't you be defining them in the chosen language?
Sure, but the point is that in a multilang site, you could need labels in different languages (based on user's preference) so I believe this also need to be translated.

My concern about this patch is related with the way locale works.
When adding url is allways "*/node/add" but what will happen when editing and the url changes?
Translating it here means that a new record will be added for every edited node?

Once again, sorry if it's just my ignorance.

#3

chx - September 23, 2007 - 22:08
Version:6.x-dev» 7.x-dev
Category:bug report» feature request

#4

lilou - August 26, 2008 - 20:53
Status:active» needs review

Reroll

AttachmentSize
translate_node_fields_d7.patch 1.28 KB

#5

Anonymous (not verified) - November 11, 2008 - 14:50
Status:needs review» needs work

The last submitted patch failed testing.

#6

strellman - December 2, 2008 - 16:57
Title:"Title" and "Body" labels are not translated» "Title" and "Body" labels are not translated, then translated wrong
Project:Drupal» Internationalization
Version:7.x-dev» 6.x-1.0-beta4
Component:node system» Code
Category:feature request» support request
Status:needs work» active

Well I started to update this report as a bug and then found out how to make it work but not work well. This is actually done with string translation in the i18n or internationalization module http://drupal.org/project/i18n as described at http://drupal.org/node/313293

Try going to /admin/build/translate/refresh
selecting content type
(I saw the following...)
Updated string group:title for textgroup nodetype: Name of group
Updated string group:title for textgroup nodetype: Action plan (This is my body field in English)

Since I couldn't find the title to translate I changed back the field labels to "Title" and "Body"

This time it took my translation for Text group - content type, and in the string column - Body / group:title so that the original text was "Body". For my Romanian translation I typed "Group Action Plan" which actually showed up as the label for the Title field instead of the Body field. Very strange!

#7

Jose Reyero - January 3, 2009 - 19:16
Status:active» fixed

These issues are fixed in latest -dev, refresh locales after updating

#8

System Message - January 17, 2009 - 19:20
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#9

noelbush - May 27, 2009 - 11:34

Prior to your next release (to avoid using a dev version of this complex module), here is a very simple module that just addresses this problem:

http://drupal.org/project/trans_core_labels

 
 

Drupal is a registered trademark of Dries Buytaert.