Articles of textdomain

How to override languages files in wp-content/languages/themes with child theme

I want to create a child theme for TwentyFifteen theme, which will customize a lot of things, including translation. When I install WordPress in my language (Farsi), it includes TwentyFifteen language files in wp-content/languages/themes So when I create a languages folder in my child theme and add customized language files to it and add load_theme_textdomain( […]

Find proper “text domain” within theme

I have a client with a wordpress theme, Nevada, and we are having trouble making the built in translations work for it. The theme contains .mo files for English, German, and Slovenian, and appear to be found by our WPML plugin. However, they are not translating any of the template text inside the theme. Translations […]

How to get menu strings, categories and tags into po file for translation

I’m prepping my theme for translation. I’ve added the following line to my functions.php, and added the text domain within my theme files. <?php /*** LOAD THEME TEXTDOMAIN ***/ load_theme_textdomain( ‘mytheme’, get_template_directory() . ‘/languages’ ); $locale = get_locale(); $locale_file = get_template_directory() . “/languages/$locale.php”; if ( is_readable( $locale_file ) ) { require_once( $locale_file ); } ?> […]

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/ […]

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. […]

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 […]

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 […]

Overwrite textdomain of plugins by default – Lost Translation

WordPress is awesome, but there is something that is driving me crazy. Whenever a plugin or a theme is updated, all files are deleted and replaced. So if I have custom code or a translation in one plugin, it will get lost! I’ve seen some solutions suggesting to change the textdomain of the plugin to […]

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. […]

Is a text-domain necessary for a child theme

Sorry for the noob question. Is a text-domain necessary for a child theme? I am building a simple child theme with no text-domain declared. So, when I use strings which are to be translated, should I use the parent theme text-domain (yes parent theme has text-domain loaded and also has .mo/.po files). For example adding […]