translation does not work with text_domain

I am trying to translate my custom plugin. I can translate my plugin if I place the fr_CA.po/.mo into my wp-content\languages\plugins manually. But I would like to be able to put my .po/.mo into my plugins folder in “myplugin/languages” Well, in the main file, I have this: * Text Domain: myplugin * Domain Path: /languages/ … Read more

load_plugin_textdomain in `plugins_loaded` or `init`?

Which is the best/recommended way to hook load_plugin_textdomain within – plugins_loaded or init? and what are drawbacks using either. 1 Answer 1 Load translation files as late as possible for your plugin’s use-case. This allows other plugins as much time as possible to fully initialise. Why should you care about other plugins? Because they may … Read more

Warning/Notice about functions.php

I have trouble about the notice shows on the top of the home page as: Notice: load_plugin_textdomain was called with an argument that is deprecated since version 2.7 with no alternative available. in …/wordpress/wp-includes/functions.php on line 2925 The code of this line is something about $wpsmiliestrans: ‘;)’ => ‘icon_wink.gif’, If I delete this code, it … Read more

switch_to_blog(): Load textdomain

I am using the WordPress multisite feature with Multilingual Press Pro to create a multilingual site with linked posts. In a network activated plugin the custom post types are registered. For translating the slug I use l10n: ‘rewrite’ => array( ‘slug’ => __( ‘products’, ‘text-domain’ ) . ‘/%product-category%’, ‘with_front’ => false ) This works fine. … Read more

How to debug failed load_theme_textdomain()?

I made my theme ready for translation. My text domain is my_theme and my .po and .mo (de_DE.po and de_DE.mo) files are located in a subfolder languages in my themes folder. In my functions.php I added the following code: add_action(‘after_setup_theme’, ‘my_theme_setup’); function my_theme_setup(){ load_theme_textdomain(‘my_theme’, get_template_directory() . ‘/languages’); } My backend language is “German” but the … Read more

Why is “plugins_loaded” not called/fired?

I am trying call load_plugin_textdomain once the plugins are loaded, however this does not happen. I do have a plugin activated, so shouldn’t this fire? add_action(“plugins_loaded”, “test_override”); function init_localization() { echo “init_localization<br>”; load_plugin_textdomain ( TEXT_DOMAIN, false, LANGUAGE_DIR ); } function test_override() { echo “text_override<br>”; } In another context, when calling add_action(“init”, “init_custom_post_types”), it works fine. … Read more