Translation of plugin in MU-PLUGINS directory not working

You need to use another action when in a mu-plugins. add_action(‘muplugins_loaded’, ‘myplugin_muload_textdomain’); plugins_loaded action work only after active plugins and pluggable functions are loaded. mu-plugins are not regular plugins and will not be loaded like them. As you can see in the following link, mu-plugins are loaded before anything else. Actions Run During a Typical … Read more

Make theme translatable for WPML

You don’t have to make anything special for WPML, using the regular translation code should be enough. See I18n for WordPress Developers in the Codex. Code preparation style.css Add Text Domain and Domain Path to your theme’s style.css. Example: /* * Theme Name: My awesome theme * Text Domain: my_awesome_theme * Domain Path: /languages */ … Read more

How to load theme textdomain from plugin?

You are completely loading your language file wrong in your plugin, and your file naming is also wrong. load_theme_textdomain(‘my_plugin’, plugin_dir_path( __FILE__ ) . ‘/languages’); should be load_plugin_textdomain(‘my_plugin’, false, dirname(plugin_basename(__FILE__)) . ‘/lang/’); Also, your mo and po files should be named my_plugin-en_US.mo and my_plugin-en_US.po. Go have a look at this tutorial also, this will help you … Read more

Translate content, not instance, per-post

The easiest approach would be to have custom fields on the edit page: one text field for every language you want to use (and perhaps different title fields?) For this you could use a plugin like ACF. This would provide an easy interface for non-tech editors. Supposing you are building your own theme you can … Read more

Localization works but still get “This plugin is not properly prepared for localization” msg in directory

I figured it out almost immediately after asking the question, after months of frustration. The issue was I was using the load_textdomain function (which was the way I learned it) instead of the apparently newer/favored load_plugin_textdomain. The working code looks like this function rsvpmaker_load_plugin_textdomain() { load_plugin_textdomain( ‘rsvpmaker’, FALSE, basename( dirname( __FILE__ ) ) . ‘/translations/’ … Read more

How to set locale in ajax requests?

(this kind of issues is part of why my standard recommendation is to not have front end with two languages) The core reason to the problem is that your ajax returns text. AJAX should be treated like API which provide machine level values which the front end translate to human text. When your code is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)