[wp-hackers] Using constants for text domain
Otto
otto at ottodestruct.com
Wed Nov 27 19:28:38 UTC 2013
On Wed, Nov 27, 2013 at 7:38 AM, Justas Butkus <jbutkus at time.ly> wrote:
>
> We are proxying calls to gettext functions (__, _x, ...) family via our
> class, so the result is much like this:
> ```
> class PluginPrefix_Foo {
>
> public function __( $string ) {
> return __( $string, PLUGINPREFIX_TEXT_DOMAIN );
> }
>
> }
> ```
>
>
... and that fails on two entirely different levels. ;)
Rather than explain in great detail, I'll refer you to three of my posts:
1.
http://ottopress.com/2012/internationalization-youre-probably-doing-it-wrong/
2. http://ottopress.com/2012/more-internationalization-fun/
3. http://ottopress.com/2013/language-packs-101-prepwork/
The first one will explain why using $string and PLUGINPREFIX_TEXT_DOMAIN
are incorrect.
The second one will make you aware of a few more functions you might not
know about.
The third will tell you how to refactor a bit so that you can properly
support the upcoming Language Pack system in WordPress.
If you have questions, ask. :)
-Otto
More information about the wp-hackers
mailing list