Why function t() arguments are not passed through t() again ?
Hello, I am trying to translate what comes from the following piece of code inside node.module:node_add() .... drupal_set_title(t('Submit @name', array('@name' => $types[$type]->name))); .... Using localization I can translate "Submit @name" to "Enviar @name". The problem is that the node type name is written in english and I can not change that name without breaking a lot of custom pages. I wonder why the previous line is not written this way: ... drupal_set_title(t('Submit @name', array('@name' => t($types[$type]->name)))); ... Another option would be to modify function t(), to automatically pass all arguments through t(). Do you see any problem with modifiying t() ?
On Fri, Jun 13, 2008 at 2:18 PM, Juan Rodriguez <juan.fco.rodriguez@gmail.com> wrote:
Using localization I can translate "Submit @name" to "Enviar @name". The problem is that the node type name is written in english and I can not change that name without breaking a lot of custom pages. I wonder why the previous line is not written this way: ... drupal_set_title(t('Submit @name', array('@name' => t($types[$type]->name)))); ...
Because t() translates static text (coming from source code), not user entered text (such as the node type name).
Another option would be to modify function t(), to automatically pass all arguments through t(). Do you see any problem with modifiying t() ?
So that would make all user names, numbers, etc end up in the translation table, right?. Such as t('@number of new posts', array('@number' => $new_post_count) would always t() the $new_post_count, and you would get 1, 2, 3, 4, up until infinity in your translation table. I don't think this is what you want. Gabor
2008/6/13 Juan Rodriguez <juan.fco.rodriguez@gmail.com>:
Hello,
I am trying to translate what comes from the following piece of code inside node.module:node_add() .... drupal_set_title(t('Submit @name', array('@name' => $types[$type]->name))); .... Using localization I can translate "Submit @name" to "Enviar @name". The problem is that the node type name is written in english and I can not change that name without breaking a lot of custom pages.
If you are running Drupal 5+, go to admin/content/types and change the node type 'nice name' there.
I wonder why the previous line is not written this way: ... drupal_set_title(t('Submit @name', array('@name' => t($types[$type]->name)))); ... Another option would be to modify function t(), to automatically pass all arguments through t(). Do you see any problem with modifiying t() ?
participants (3)
-
Gábor Hojtsy -
Henrique Recidive -
Juan Rodriguez