sequra_get_locale
Hook
Filter
Allow changing the country of the shopper.
Description
This filter allows modifying the locale string that defines the language used to show the promotional components. This is helpful in some cases when an internationalisation engine that relies on JavaScript is being used to translate the frontend (e.g., WeGlot, GTranslate plugin or similar). In those cases, the frontend language mismatch the one retrieved from the standard WordPress functions which lead to errors in the promotional components internationalisation.
Parameter | Type | Description |
---|---|---|
$locale | string | The locale code. Example ES-es |
Changelog
Version | Description |
---|---|
3.2.0 | Introduced |
Usage Example
// Example for when the WeGlot plugin is in use.
add_filter('sequra_get_locale', function($locale){
if( !function_exists('weglot_get_current_language') ) {
return $locale;
}
return weglot_get_current_language();
});
Updated about 1 month ago