[development] t() API documentation

Gábor Hojtsy gabor at hojtsy.hu
Tue Feb 15 10:26:21 UTC 2011


Hi,

The main point is that it makes it easier to grep/find the source
strings in code, and figure out additional information on where are
they used. It is not a critical thing but can be very helpful.

Gábor

On Tue, Feb 15, 2011 at 10:55 AM, sivaji j.g <sivaji2009 at gmail.com> wrote:
> Hello,
>
> t() API documentation reads "Avoid escaping quotation marks wherever possible".
>
> Below is the snippet from
> http://api.drupal.org/api/drupal/includes--common.inc/function/t/6
>
> Incorrect:
> <?php
>  $output .= t('Don\'t click me.');
> ?>
>
> Correct:
> <?php
>  $output .= t("Don't click me.");
> ?>
>
> However the core user module's hook_block implementation is following
> incorrect style. The same is the case with D7 user module as well.
>
> I think the purpose of avoiding t('Don\'t click me.'); style is just
> to make it more readable and easier for translation.
>
> Is there any reasons for encouraging incorrect style in core. Please
> enlighten me on this.
>
>
> --
> Sivaji
> +91 9941 571 690
>


More information about the development mailing list