0

I am trying to add language/translation support for my Wordpress plugin using POEdit software to create .po files, but the code isn't working and there are no screen error printing out.

My plugin is located in /plugins/site-status/ and the languages directory is located as /plugins/site-status/languages/. In /languages/ directory all .po files have names such as site-status-en_US.po (the unique identifier is called site-status) Here is the language support code:

function status_language_init() { load_plugin_textdomain( 'site-status', false, 'site-status/languages/' ); } add_action('init', 'status_language_init'); 

Here is the test code for outputing the default/translated text:

echo _x( 'test', 'site-status' ); 

I very much look forward for your help!

Thanks in advance and with best wishes, WHOAMi

2
  • See wordpress.stackexchange.com → translation. Commented Mar 9, 2012 at 4:27
  • I have already surfed around stack and google search. Nothing comes handy to resolve my problem. Commented Mar 9, 2012 at 4:38

1 Answer 1

1

To debug this, check the return value of load_plugin_textdomain(). And don’t rely on a directory name of your plugin. The user can change it.

$path = basename( dirname( __FILE__ ) ) . '/languages'; $lang_loaded = load_plugin_textdomain( 'site-status', FALSE, $path ); // die harder! ! $lang_loaded and die( $path . ' not found' ); 
Sign up to request clarification or add additional context in comments.

2 Comments

site-status/languages not found
P.S. Id voted for your answer but i joined here just few minutes ago. Thanks anyway! :/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.