Titles in my sidebar widget appear in all languages – with qtranslate

Hi Will also try this: Add this to your functions.php function get_qTrans_TitleText($text) { $language=qtrans_getLanguage(); preg_match(‘/<!–:’.$language.’–>(.*?)<!–:–>/’, $text, $matches); return strip_tags($matches[0]); } And then: <?php echo get_qTrans_TitleText($text); ?> Have no Idea what version of qTranslate and WP you have so you may even use __() to get the correct title or _e() to echo it.

Can’t set proper WooCommerce language translation [closed]

After installing WordPress version 4.6.1 and WooCommerce version 2.6.6, both with the default enabled language, English (United States), I followed the steps below and had the translation successfully installed and working: Set a language for your WordPress installation Click on the General sub-menu item under Settings from the Dashboard of your WordPress installation, and scroll … Read more

How to prevent text modified using gettext filter being stomped (presumably) by updateText() js function within a CPT’s edit screen

First, you have nasty typo in __contsruct. 🙂 Second, your hook timing is wrong. Related WP JavaScript is localized via postL10n object (you can see it echoed in page’s source), that gets put together on init hook – way earlier then admin_head and your filter is not in place yet. From quick test this should … Read more

How to concatenate inside the _e() function the right way?

the_search_query() echoes itself, so by putting it into another echo function (what _e() is) you’ll get result as in second example. It isn’t recommended to use variables or function inside l18n functions, because they can’t be translated, for more information see Otto’s: Internationalization: You’re probably doing it wrong. So you should use code like this: … Read more

Unknown language json files

what are these language files for? (I guess it is for localizing javascript?) You guessed right. The JSONs are for use specifically with the new wp_set_script_translations function in WordPress 5. is it necessary to add/commit/push them to the live server? They are used at runtime, just like .mo files are. So yes, add them to … Read more

Cache WordPress translations

I answered a similar question on Stack Overflow recently. Don’t forget that the profiler itself adds a big overhead. If your page loads are still really slow with XDebug disabled then I don’t think your problems are limited to translation files and you should look at caching entire pages. You can eliminate MO file loading … Read more

How to auto-translate custom user roles?

The translate_user_role function is just a wrapper for translate_with_gettext_context, defining the context ‘User role’. In this last function, there is the filter hook gettext_with_context, which provides the context as well as the currently used domain. So we could do this: function wpdev_141551_translate_user_roles( $translations, $text, $context, $domain ) { $plugin_domain = ‘plugin-text-domain’; $roles = array( ‘Someone’, … Read more

Disabling Translation Update

You’ve already given the answer using auto_update_translation. I wasn’t aware this didn’t work after manual updates (and haven’t tried it) but perhaps also look at async_update_translation which according the documentation “Asynchronously upgrades language packs after other upgrades have been made”. Regardless of the above, I recommend a different approach whereby the community translations are still … Read more