[development] Translating database fields

Gábor Hojtsy gabor at hojtsy.hu
Wed Sep 23 13:17:17 UTC 2009


On Wed, Sep 23, 2009 at 3:10 PM, Ken Winters <kwinters at coalmarch.com> wrote:
> Hmm, tt() doesn't seem very developer friendly.
>
> If you're developing a module that is translatable, you can't realistically
> require i18n, and checking for the module / function in 100 places would be
> unpleasant (assuming that it is normally used the same way as t() in the
> code).
>
> Other than making a wrapper function in the module that passes to tt() if it
> exists, do you have any suggestions to make this cleaner?

You definitely should not require i18n if your module just provides
optional translation support. You'll need to define tt() yourself
conditionally I guess. There is no way in Drupal (I know of) to
invoke_if_exists_otherwise_return_the_args_to_me(), even
module_invoke() skips returning you stuff if the hook was not defined.

Gábor


More information about the development mailing list