In connection with my next issue, i see, the latest dev you try to fix page titles translation problem. It's nice, but not so good.

drupal_set_title(t($title));

First, this without check_plain() is insecure.
Second, raw user input doesn't recommend to use with t(). We discussed this with Bálint Kléri, but can't figured user friendly and "drupalish" way together.

The correct workflow should be use i18n_variables in this case. Or enable use the original page title generation, this is another issue, I'm writing.

Comments

szantog’s picture

lelizondo’s picture

Yeah, the right way to do this apparently is with:

<?php check_plain(t($text_here)); ?>
szantog’s picture

Title: Text variables translation » Page title translation
szantog’s picture

Title: Page title translation » Text variables translation

And the same problem with submit button text:

function nodeformsettings_elements_default() {
  return array(
    ...
    'nfs_submit' => t('Submit);
    ...
  )
}

Default value in t() is completely wrong, when I submit the node settings form.

nfs_submit value in english: Submit
nfs_submit value in hungarian: Beküldés

If I edit the node type form in hungarian langauage, i get the default value from t(). In this case 'Beküldés'. I save the node type settings form, the variable value would be saved as 'Beküldés'.
Then print out trough another t() on node add/edit form, the wrong hungarian text will be inserted as translation default text.

atlea’s picture

Title: Page title translation » Text variables translation

Hi,

I noticed my locales_source filling up with node titles after enabling this module (7.x). Running t() on user input is plain WRONG. Why would you want to translate the title anyway?

    $title = strtr($settings['nfs_title_edit'], $replace_pairs);
    drupal_set_title(t($title));

should probably be

    $title = strtr(t($settings['nfs_title_edit']), $replace_pairs);
    drupal_set_title($title);

??

achton’s picture

Version: 6.x-2.x-dev » 6.x-2.0
StatusFileSize
new1.44 KB

Here is my take on this (patched against 2.0 release, sorry).

osopolar’s picture

Version: 6.x-2.0 » 6.x-2.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.41 KB

Patch for current dev. Practically the same as in #7, but without strtolower. So it's almost RTBC ;)

kssundar’s picture

Status: Needs review » Fixed

Ported to 6.x-3.x

Status: Fixed » Closed (fixed)

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