0

Ok i built plugin for contact form, I wanna add translation for it. In my main plugin files i add this code

function ap_action_init()
{
// Localization
load_plugin_textdomain('prijava_forma', false, dirname(plugin_basename(__FILE__))."/languages");
}

// Add actions
add_action('init', 'ap_action_init');

in my file where contact form is written i have this

_e('Prva','prijava_forma');

In my language folder i added .mo and .po files created with poedit.

Also i defined WPLANG in config.php, and change lang in admin section

But i get no translation. Where could be problem, i am new to this?

  • Why do you use an URL to access a local path? That cannot work. – fuxia Nov 18 '14 at 15:52
  • try already with dirname(plugin_basename(FILE))."/languages" not working – Vladimir Štus Nov 18 '14 at 15:57
  • What are the name of the languages files? – cybmeta Nov 18 '14 at 16:02
  • ru.mo and ru are names – Vladimir Štus Nov 18 '14 at 16:04
0

I´m using this code to get translated my themes: add_action('after_setup_theme', 'my_theme_setup'); function my_theme_setup(){ load_theme_textdomain('lc_realty', get_template_directory() . '/languages'); } the files are named ru_RU.mo and ru_RU.po I have no problems with this code on versions 3.3.1 to 3.8.3 I will upgrade to 4.0 soon son I hope this continue working well.

Also I have this code to translate the plugins in admin panel if ( is_admin() ) load_plugin_textdomain( 'myslider', false, 'myslider/languages' );
this code goes inside the functions setup of the plugin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.