[wp-hackers] Why strings aren't translated here?

Milan Dinić liste at srpski.biz
Sun Nov 8 12:42:23 UTC 2009


I solved this by placing another load_plugin_textdomain function in function
that is run on register_activation_hook. That way string is localized on
activation of plugin.

For second string I followed your advice and replaced variable with
function, and string is localized in function.

Thank you for your help.

2009/11/2 Otto <otto at ottodestruct.com>

> On Fri, Oct 30, 2009 at 3:20 PM, Milan Dinić <liste at srpski.biz> wrote:
> > Now I tried what you suggested ( $gse_options['tip_text'] =
> sprintf(__("It
> > seems that ... ) but it still doesn't translate that string. Maybe is
> > problem because it is run in register_activation_hook.
>
> Yes, that is indeed your problem. Or, rather, the lack of the init is
> your problem.
>
> When the activation hook fires, your plugin has just been included.
> Init occurred before that happened. So your init doesn't get run, and
> thus your text domain never gets loaded before you try to start
> translating things. You need to load the text domain before you use
> translation functions.
>
>
> -Otto
> Sent from Memphis, TN, United States
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list