[wp-hackers] Settings API -- Translation issues

wpmidia lab wpmidia at gmail.com
Sun Sep 30 15:41:49 UTC 2012

Hi Otto!
Thanks for responding....

I have this here:

//Hook up to the init action
add_action( 'init', 'init_wp_coming_soon' );
* Runs when the plugin is initialized

function init_wp_coming_soon() {
  // Setup localization
  //load_plugin_textdomain( 'wp_coming_soon', false, dirname(
plugin_basename( __FILE__ ) ) . '/lang' );  <--- doesn't work!
  load_plugin_textdomain( 'wp_coming_soon', false, dirname(
plugin_basename( __FILE__ ) ) );

  // Load JavaScript and stylesheets

  add_action('wp_footer', 'frontend_add_to_footer');
  add_action('admin_menu', 'wp_coming_soon_add_admin_menu');
  add_action('admin_footer', 'backend_add_to_footer');


2012/9/30 Otto <otto at ottodestruct.com>

> On Sun, Sep 30, 2012 at 9:13 AM, wpmidia lab <wpmidia at gmail.com> wrote:
> > I'm having difficulty translating the options page of my plugin, using
> > Settings API.
> > Only the menu item and the page title are translated. Form fields
> > configuration (an array), do not translate.
> > What am I doing wrong?
> You're defining these options and translating those strings into a
> variable in the main body of the plugin (inside global scope), but not
> calling the load_plugin_textdomain call until the 'init' action hook.
> This means that your strings are being translated before your
> text-domain loads, because the plugin load happens before init runs.
> Move the definition of the settings (and translation of those strings)
> into a function, then call that from your init function *after* you've
> loaded your text-domain.
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

*Míriam de Paula *
*Twitter:* @miriamdepaula

*desenvolvimento web*
twitter: @wpmidia

*WordPress Brasil no Facebook:*

*OpenCart Brasil no Facebook:*

*Hospedagem de Qualidade é na HostGator<http://www.hostgator.com.br/6133-4.html>

More information about the wp-hackers mailing list