I can’t translate text in my plugin using a .mo file, load_plugin_textdomain() function is always false

(Revised answer) The simple answer is because WordPress could not find the MO file, despite the file itself exists (in the plugin’s languages directory). And here’s why: The MO file needs to be named following this format: {text-domain}-{locale}.mo, and {text-domain}-{locale}.po for the PO file. See Loading Text Domain for further information. So you’re trying to … Read more

WordPress For Urdu Language

WordPress is community translated. For a good number of languages, the translation is relatively complete and follows high quality standards. The codex page on WordPress in your language reports: WordPress in Urdu – اردو is ongoing, but slow. Need more contributors. So in essence: No, WP is not entirely translated to Urdu yet. You could … Read more

Can’t manage to make translate_user_role() work

I think your function nesting is slightly muddled; call ucfirst after translating, like so: esc_html( ucfirst( translate_user_role( $user->roles[0] ) ) ); My bad, completely skipped a beat there. You should instead be using: translate_user_role( $GLOBALS[‘wp_roles’]->role_names[ $user->roles[0] ] ); It’s unreliable to assume that all role display names are simply ucfirst( $role key ). If that … Read more

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

Since WP 4.6 load_theme_textdomain() (and consequently load_child_theme_textdomain()) will give priority to .mo files downloaded from WP’s online translation platform (translate.wordpress.org). Due to some new code (here, on line 769) these functions will completely ignore your local .mo files if the textdomain is found in the general languages/ directory. You can, however, use the more basic … Read more

Custom translation of Month names

Add the following to your existing functions.php file: function ra_change_translate_text( $translated_text ) { if ( $translated_text == ‘January’ ) { $translated_text=”Jan11″; } return $translated_text; } add_filter( ‘gettext’, ‘ra_change_translate_text’, 20 ); If you want to change multiple strings, use this function instead: function ra_change_translate_text_multiple( $translated ) { $text = array( ‘January’ => ‘Jan11’, ‘February’ => ‘Feb22’, … Read more

trying to modify colormag-fr_FR.po

Just modifying the .po file doesn’t do anything. The .po is the template. To be displayed, the .po must be compiled into an .mo file and it is the compiled .mo that makes the translations. If you’re just editing the .po in a text editor, you’re not changing anything. You’ll need a compiler. A good … Read more

Suggestions for i18n plugin [closed]

I’ll speak for qTranslate, I’ve used it a few times and been pretty happy with it. What it sets out to do – letting you offer translations of post content in multiple languages and switch between them – it does pretty well. It gets a bit dicey when you try to extend it beyond alternate … Read more

How to use Yoast SEO backend in english even if WPLANG variable is not english?

That plugin loads its language the moment its main file is included: load_plugin_textdomain( ‘wordpress-seo’, false, dirname( plugin_basename( __FILE__ ) ) . ‘/languages’ ); So when your locale filter is used, the language is already there. :/ Move your small plugin into the mu-plugins directory. You can create it if it doesn’t exists in wp-content. That … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)