Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
Translations only load from `wp-content/languages/plugins` but not from the plugin’s languages folder
Rename existing cpt and taxonomy with new textdomain
With honor to @Wyck’s link, I managed to add a language variable by adding an action hook to init and set the locale into cookie using PHP’s setcookie() function. For details, visit: Setting custom cookies in WordPress
_x() is for string with a context. So your second argument is just the context, and there is no text domain. Suggestion: $string = _x( ‘%1$s %2$s – %3$s %4$s’, # string to translate ‘recent comments 1 = gravatar, 2 = … ‘, # context for translators ‘thst’ # text domain ); $visible = sprintf( … Read more
Turns out you have to add some special function sniffing in the configuration of the pot file (from http://www.cssigniter.com/ignite/wordpress-poedit-translation-secrets/): __ _e __ngettext:1,2 _n:1,2 __ngettext_noop:1,2 _n_noop:1,2 _c _nc:4c,1,2 _x:1,2c _nx:4c,1,2 _nx_noop:4c,1,2 _ex:1,2c esc_attr__ esc_attr_e esc_attr_x:1,2c esc_html__ esc_html_e esc_html_x:1,2c
You have slight timing issues because you generate title first (in constructor call), but postpone text domain load to later (init at default priority). Text domain mus be loaded for __() to translate correctly. Those are not “lazy”, they generate and return strings right where they are called. Text domain should be loaded very early, … Read more
Yes you can do it, just find the file where the text resides, maybe single.php or single-{post_type}.php or archive-{post_type}.php Then, look for the string you want to change erase it and set a variable, something like this: If the file where the string is, is a template file for that specific post type, the you … Read more
Check that the file style.css is written: Text Domain: my-text-domain Check that is activated in the template files: load_theme_textdomain(‘my-text-domain’);
If you load a text domain in child theme, you may need call it in after_setup_theme filter which loads immediately after all the theme functions.php. You may refer to this note It could be due to the loading sequence. Since I haven’t seen it in your above code. I guess you load the text domain … Read more
Seems like the right thing to do there is to call esc_html instead of esc_html__. I have a feeling you don’t need any escaping there at all.