sequra_get_locale

Hook Filter

Allow changing the locale.

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.

ParameterTypeDescription
$localestringThe locale code. Example ES-es

Changelog

VersionDescription
3.2.0Introduced

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(); 
});