New answers tagged translation
WP has very good support for this. You will be Internationalizing and then Localizing your theme. Internationalization is often abbreviated as "i18n" because there are 18 letters between the 'i' and the 'n'. The Codex provides a great reference on what needs to be done here: https://codex.wordpress.org/I18n_for_WordPress_Developers Much of the work ...
This is, in fact, already available by default. If specific locale isn't available in plugin's folder WordPress will try to fallback to languages directory. It is defined by WP_LANG_DIR constant and for plugins the default location would be wp-content/languages/plugins. Note that name is expected to follow the specific format: name-locale.mo.
Ok, I just figured it out. Sometimes writing it down gives you a clearer perspective about your own problem. I didn't know this before, but _x() provides context, and I was providing a context that does not exist. So I just eliminated the whole context thing from the equation by switching the _x()s for regular __()s and the whole problem was solved :) And ...
So to make plugin translatable via translate.wordpress.org you need to add text domain into main plugin's file: /* * Plugin Name: My Plugin * Author: Plugin Author * Text Domain: my-plugin */ So to make theme translatable via translate.wordpress.org you need to add text domain into main theme's file: /* * Theme Name: My Theme * Author: Theme Author * ...
Top 50 recent answers are included