Library/helper for determining the current language selected (different multilingual plugins)
This repository has been deprecated because it is sufficient to use get_locale()
for
retrieving the current locale across different language plugins.
There is a confusion over 'Language' and 'Locale'. A 'Locale', in some plugins also called '(Language) Code', is more precise and standardized (e.g. 'en_US', 'en_GB' or 'fr_FR', 'fr_CA') while 'Language' is usually expected to be just the primary language part of the Locale or even the full name of language derived from the Locale ('en' or 'fr' - 'English', 'French' described in some plugins - for the previously given examples).
Whether all these plugins properly return the locale in the same format has to be determined yet (see TODO below).
Should this explanation itself be too inaccurate or you think can be further improved, feel free to create an issue so this can be fixed!
get_current_locale()
Supports the WPML style
ICL_LANGUAGE_CODE
constant and
additionally exposes its own function
pll_current_language(name, locale or slug)
.
Stores the current locale in
ICL_LANGUAGE_CODE
.
qtrans_getLanguage()
Compatibility code in recent version
(Relevant issue: https://github.com/inpsyde/MultilingualPress/issues/263)
(global namespace):
mlp_get_current_blog_language($short = FALSE)
(Inpsyde\MultilingualPress
namespace):
Inpsyde\MultilingualPress\get_current_site_language($language_only)
transposh_get_current_language()
the_curlang()
(soon obsolete according to source comment)
Please create an issue and tell me!
- Returned locale normalization (if required).