Documentation for Developers
This function works in the same way as the polylang function for an easier integration of Falang.
IMPORTANT: when using one or more of these functions, you *must* check for its existence before using it, otherwise your site will badly break with a fatal error at the next Falang update (as WordPress deletes the plugin when updating it).
falang_current_language
Returns the current language
the Polylang like function (pll_current_language)
falang_current_language($value);
- ‘$value’ => (optional) either ‘name’ or ‘locale’ or ‘slug’, defaults to ‘slug’
returns either the full name, or the WordPress locale (just as the WordPress core function ‘get_locale’ or the slug ( 2-letters code) of the current language.
falang_default_language
Returns the default language
the Polylang like function (pll_default_language)
falang_default_language($value);
- ‘$value’ => (optional) either ‘name’ or ‘locale’ or ‘slug’, defaults to ‘slug’
returns either the full name, or the WordPress locale (just as the WordPress core function ‘get_locale’ or the slug ( 2-letters code) of the current language.
Code for specific language
if (class_exists( 'Falang' )) {
$current_locale = Falang()->get_current_language()->locale;
if ($current_locale == 'en_US'){
//my code for english
}
if ($current_locale == 'it_IT'){
//my code for italian
}
if ($current_locale == 'fr_FR'){
//my code for french
}
}