[development] hook_perm() and t()
Gabor Hojtsy
gabor at hojtsy.hu
Wed Sep 6 11:19:38 UTC 2006
Hi Augustin,
> hook_perm() doesn't use t()?
> I've checked a few core modules, and the perms are not wrapped in t().
> Does this mean that the perms in ?q=admin/user/access are never translated?
>
> Is this valid?
>
> /*************************************
> * Implementation of hook_perm()
> *************************************/
> function hook_perm() {
> return array(t('administer hook'));
> }
> and:
> 'access' => user_access(t('administer demexp')),
>
> http://api.drupal.org/api/HEAD/function/hook_perm
> makes no mention of t() either way.
There is no need to use t() here, since the string extractor takes care of
extracting permission names defined in the perm hook for translation. It
might be more consistent to use t() all over the user_acess() calls, but
it seems superfluos. The permission names are translateable, they are just
a special case in the extractor, and are t()-ed on the display of the
permission table.
Gabor
More information about the development
mailing list