Force Plugin to English Translation

What’s the plugin? Is it using custom translations in mo/po files? Is there an admin interface which allows you to set the plugin locale? There is a generic filter which you might be able to add to the plugin code to set the language which might look something like the following (obviously set the language … Read more

Best pratice to make taxonomy terms translatable without changing slugs?

I’m not really up to date on WPML and how it handles translations, but my general understanding is that in most cases it simply creates duplicate entries for each language and links them together with the “original”. However, I recently hade a similar problem where I needed the ability to add a “pluralized” version of … Read more

How to escape single and plural i18n text strings?

esc_html_e() and esc_attr_e() are merely wrapper functions for _ to save a little bit of typing and help with readability. You’re right, there isn’t one for _n, so you’ll just need to do the “wrapping” yourself: printf( esc_attr( _n( ‘%s item’, ‘%s items’, $count, ‘textdomain’ ) ), number_format_i18n( $count ) );

Translating an error message

The gettext filter can be used to change strings that use the gettext functions. add_filter( ‘gettext’, ‘wpse_change_error_string’, 10, 3 ); /** * Translate text. * * @param string $translation Translated text. * @param string $text Text to translate. * @param string $domain Text domain. Unique identifier for retrieving translated strings. * * @return string */ … Read more

Best way to filter featured image text for a custom post type?

Regardless if you go the PHP or jQuery route, I suggest you set up your filters or enqueue your Javascript in the admin_head-post[-new].php or admin_print_scripts-post[-new].php hook. There you can be sure that the global variable $post_type is set, and can check whether it is slide. Since the post thumbnail code is called after these hooks, … Read more