Skip to content
Snippets Groups Projects
Commit 0565814a authored by Lucas García's avatar Lucas García
Browse files

feat: replace language code by locale code on Accept-Language header value

parent 714f54f0
No related branches found
No related tags found
No related merge requests found
...@@ -2,15 +2,18 @@ ...@@ -2,15 +2,18 @@
function wpct_oc_user_locale() function wpct_oc_user_locale()
{ {
$locale = apply_filters('wpml_current_language', null); $language = apply_filters('wpml_post_language_details', null);
if (!$locale) { if ($language) {
$locale = $language['locale'];
} else {
$locale = WPCT_OC_DEFAULT_LOCALE; $locale = WPCT_OC_DEFAULT_LOCALE;
} }
return $locale; return $locale;
} }
function wpct_oc_accept_language_header() function wpct_oc_accept_language_header()
{ {
$locale = wpct_oc_user_locale(); $locale = wpct_oc_user_locale();
return $locale . ', es;q=0.5'; return $locale . ', ca;q=0.9';
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment