On line 400 of stormticket.module
The title of the of form field is created with '#title' => check_plain($type->title_label),
I believe it should be '#title' => t(check_plain($type->title_label)),
For the body it's on line 471...but I'm not too sure what it should be.

Thank you,
Jonathan

Comments

Magnity’s picture

t() needs to be passed an absolute value, not a variable.

So those labels aren't currently being translated?

iamjon’s picture

I couldn't get them to translate... the 'fix' I posted worked for me. But I didn't want to hack the module so I overrode the form in a custom module like so:

$form['title'] = array(
'#type' => 'textfield',
'#title' => t(Title),
'#required' => TRUE,
'#default_value' => $node->title,
'#weight' => module_exists('content') ? content_extra_field_weight($node->type, 'title') : -18,
);

$form['body_field']['body']['#title'] = t(Description);

Is there a better way of doing it?

iamjon’s picture

Thank you for replying so quickly

Magnity’s picture

Yes, that works for the translation itself, but doesn't allow the values to be parsed by translation engines etc.

I'll try to find out where the actual string is.

By the way: very pleased that you're using custom modules to do all of your changes. Quite often people just hack the module itself, and of course losing all of their changes if they update the module!

Magnity’s picture

The string does have t() around it, but because it is then stored in the database, it doesn't help. It is bad to put the t() directly around the variable as then the i18n client will give errors on parsing the files.

I've seen tt() used in some places.

Is there anyone who has seen a solution for this before?

carsten müller’s picture

Hi,

there is a bug in the internationalization module (i18n). The title_label and the body_label of the hook_node_info() are saved in the database in the table node_info. When fetching the node type info first the default values of hook_node_info() are fetched and then replaced by the informations from the database.

You can change the values of the title field and the description field in the settings of the content type:
go to admin/content/node-type/stormticket
there is a fieldset named "Submission form settings". Here you can change the title of the title and the description field

If changing these values the new labels will be used. But these new labels are not translated. Neither by the Drupal Core nor by the internationalization module. There is a module in i18n for translation the content types. It also finds the strings of the title_label and the body_label but they do not get translated.
In the i18content module only the help text will be translated. So i think this is a bug in the i18ncontent module.

See:
http://drupal.org/node/763536
http://drupal.org/node/412154

juliangb’s picture

I'm not sure if the linked issues relate to exactly the same problem as this - but we should follow them to see what happens. Does anyone know how other modules translate these labels?

juliangb’s picture

Category: bug » task
Priority: Minor » Normal
juliangb’s picture

Status: Active » Fixed

I believe the underlying problem in the i18n module has been fixed.

#763536: Cannot translate content type name.

Status: Fixed » Closed (fixed)

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