I am creating translations for my plugin. To fetch .mo files from my-plugin/languages directory , I use the function //Load translation function load_plugin_textdomain() { load_plugin_textdomain( 'my-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' ); } add_action( 'plugins_loaded', 'load_plugin_textdomain' ); How can i set the location to wp-content/languages Setting the location to ABSPATH.'/wp-content/languages' doesn't work.
From start: A = main plugin(the library), B = child plugin I develop a plugin B that will depend on another plugin A in order to work properly. I do this because I'm one of the persons who don't like code duplication. So I have a plugin with the library required for other plugins A and another plugin that will do only what it should but only if plugin A is activated. Everything is working well, but... I also need …
I translated my plugin and put all the files (my-plugin-de_DE_formal.po, my-plugin-de_DE_formal.mo, my-plugin.pot) in the wp-content/plugins/my-plugin/languages folder. My plugins header says: … Text Domain: my-plugin Domain Path: /languages … Inside my code I loaded the textdomain like that: function mp__load_textdomain() { load_plugin_textdomain( 'my-plugin', false, 'my-plugin/languages' ); } add_action( 'init', 'mp__load_textdomain' ); I also check the return value of load_plugin_textdomain and it says true. But all my translations will not show up. But if I move the .po and .mo files to …
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 ); } ?> I've used poedit to generate my po files. It is finding some of the strings that are labeled with the text domain, but it's not …
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( 'twentyfifteen', get_stylesheet_directory() . '/languages' ) to my child theme's functions.php my customized language files do not load and instead the files in wp-content/languages/themes load. What …
Context: I have created a plugin that is enabled only at the network level and it handles certain synchronizations between the child sites. As it is a network level plugin, it has its menu added to the network dashboard instead of the admin dashboards of child sites. Problem: I have implemented internationalization in the plugin following strict practices from the WordPress codex. For some reason, the load_plugin_textdomain function cannot load the .mo files I have generated. I have verified the …
I am struggling to load translation in JavaScript for my simple plugin. Translation works for PHP, but not in JS. What seems to be the problem, how can I debug this? I have loaded text domain in my plugin method and this works ok. My text domain is instantsearch, locale for my language is hr load_plugin_textdomain('instantsearch', FALSE, basename( dirname( __FILE__ ) ) . '/languages/'); // returns true var_dump(__('No results', 'instantsearch')); // This shows correct translation for my language I have …
I've had for a long time a site with the famous Recent Tweets Widget. The plugin came as part of a theme, and back in the day, it included translation .po and .mo files for French language. I didn't pay attention to this before. But recently I have found that the strings indicating the tweet's age (x days/months ago, etc.) are translated into Spanish, main language of the site. I have confirmed that the translated strings are not in the …
Function in a plugin is behaving differently than function in the functions.php inside a child theme. I have a custom simple plain plugin with nothing but the following code in it and it works perfectly. It translates wpamelia plugin correctly with all strings as expected. add_filter( 'load_textdomain_mofile', 'load_custom_plugin_translation_file', 2, 2 ); function load_custom_plugin_translation_file( $mofile, $domain ) { if ( 'wpamelia' === $domain ) { $mofile = ABSPATH . DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . '/amelia-translate/de_DE/wpamelia-de_DE.mo'; } return $mofile; …
I'm currently using this to reload my theme and plugin textdomain in order to send e-mails (admin move, in admin language) in the user language. add_filter("theme_locale", array($this, "theme_locale"), 9999, 2); add_filter("plugin_locale", array($this, "plugin_locale"), 9999, 2); $this->load_textdomains(); remove_filter("theme_locale", array($this, "theme_locale"), 9999, 2); remove_filter("plugin_locale", array($this, "plugin_locale"), 9999, 2); public function load_textdomains() { if (function_exists("WC")) { WC()->load_plugin_textdomain(); } if (class_exists("My_Plugin_Class")) { My_Plugin_Class::load_plugin_textdomain(); } load_my_theme_textdomain(); } And the theme/plugin functions works like this: function load_my_theme_textdomain(){ unload_textdomain('my-theme-textdomain'); load_theme_textdomain('my-theme-textdomain', get_template_directory() . '/i18n/'); } And thats okay, …
How can I translate the name of plugin for other languages? For example: When Wordpress is in pt-BR language, the plugin would be "Meu plugin". If the Wordpress is in en-XX language, the plugin name would be "My plugin". Thanks!
This is the example on the WordPress codex: /* * Theme Name: My Theme * Author: Theme Author * Text Domain: my-theme * Domain Path: /languages */ Is it possible the for the directory be called "mytheme" or does it have to be "my-theme"?
I created a theme and I want to publish it in wordpress.org. I used TGM library to check to require plugins. but the Theme-check get bellow warning: Warning: More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs. Should I change text-domain of TGM library? Or like the Envato, it's not necessary to change text-domain of TGM?
https://codex.wordpress.org/Function_Reference/register_taxonomy i have these doubts _x( 'Categories', 'taxonomy general name' ) does it make taxonomy general name a text domain? wont it resulting in multiple translation? __( 'All Categories' ),__( 'Edit Category' )etc does not seems to have any text domain, is it required?
There is a plugin: In admin area it has about 300 various strings added via __('', 'my-textdomain'). Most of these are form labels, titles, etc. On "frontend" (which end user sees), there just 15 strings added via the same __('', 'my-textdomain') method Most website editors will want to translate "frontend" part. Admin area part is technical and most editors will understand english version. Is it worth having two plugin textdomains - one for admin area strings and another one for …
I'm really stumpted here. I've got this code to load my textdomains for the english version of the site I'm working on. The following code is in the Functions.php theme file. if(ICL_LANGUAGE_CODE == 'en'){ $textdomainLoad = load_textdomain( SHIROI_THEME_DOMAIN, get_template_directory().'/lang/en_US.mo' ); load_textdomain( "site", get_template_directory().'/lang/en_US.mo' ); echo '<!--textdomainloadednohook '.$textdomainLoad.'-->'; } This usually works. But on this website, it doesnt. I checked, and my textdomain is correct. The echo underneath echoes at the beginning of the page, meaning the file is OK and …
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 this line in my child theme template <?php __('Some String', 'parent-text-domain');> Will be above string be translated? Thanks in advance