[development] Why function t() arguments are not passed through t() again ?
Gábor Hojtsy
gabor at hojtsy.hu
Fri Jun 13 12:26:28 UTC 2008
On Fri, Jun 13, 2008 at 2:18 PM, Juan Rodriguez
<juan.fco.rodriguez at 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
More information about the development
mailing list