How to translate theme strings using Polylang

Home / WMPL / How to translate theme strings using Polylang

One of the powerful (or let’s say useful) functions that ship with WMPL iICL_LANGUAGE_CODE, allowing you to translate strings using PHP conditional check. This is particularly useful for translating widgets and some other theme translations.

But if you’re not inclined to purchase WMPL, but still need this feature, I only found it within Polylang plugin (when talking about free WordPress plugins). The plugin itself comes with very useful and generous function reference where you will also find the following function

This function returns the current language, making it useful in the following way:

This allows you to create your own conditions based on current language code, making Polylang great free alternative to WPML.