How to use load_plugin_textdomain on activation of plugin

With my new plugin, Gravatar Signup Encouragement, I had a problem with translation of string that is used only on activation.

That string contains default message that is saved in database. No matter what I tried, it would always save original string, not translation.

After asking question on wp-hackers mailing list and exchanging several replies with Otto, I found solution for this. In your function that is used in register_activation_hook, you need to again use function load_plugin_textdomain, even if you loaded it already in init. It should be used before any string.

So if you encounter this problem, you know how to solve it.
Don’t forget to try my plugin mentioned here, Gravatar Signup Encouragement.

Leave a Reply

Comment Guidelines:
  • Your email address will not be published
  • Fields marked with * are required
  • If you want your picture next to comment, open an account at Gravatar
  • If you want to know if someone replied to your comment, check “Notify me of followup comments via e-mail”
  • You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>