Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Utils_I10n::get_non_en_accepted_wp_locales_from_header()
Get locales matching the HTTP accept language header.
Description Description
Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
Return Return
(array) List of locales.
Source Source
File: classes/Utils/I10n.php
public static function get_non_en_accepted_wp_locales_from_header() { $res = array(); $http_locales = self::get_http_locales(); if ( empty( $http_locales ) ) { return $res; } if ( is_array( $http_locales ) ) { foreach ( $http_locales as $http_locale ) { $http_locale = explode( '-', $http_locale ); $lang = $http_locale[0]; $region = ! empty( $http_locale[1] ) ? $http_locale[1] : null; if ( is_null( $region ) ) { $region = $lang; } /* * Discard English -- it's the default for all browsers, * ergo not very reliable information */ if ( 'en' === $lang ) { continue; } // Region should be uppercase. $region = strtoupper( $region ); $mapped = self::map_locale( $lang, $region ); if ( $mapped ) { $res[] = $mapped; } } $res = array_unique( $res ); } return $res; }
Expand full source code Collapse full source code View on Trac