Category
stdlib · php-src-strict · child of #3336 / extends Locale surface (#6696)
Problem
Locale OOP today covers getDefault/setDefault/getPrimaryLanguage/getRegion/getScript/getDisplayName. Negotiating Accept-Language / preferred locale lists still missing:
| API |
Role |
Locale::lookup() / locale_lookup() |
Best match from locale list vs locale |
Locale::filterMatches() / locale_filter_matches() |
Filter match predicate |
Locale::acceptFromHttp() / locale_accept_from_http() |
Parse HTTP Accept-Language |
| Check |
Zend + intl |
VM (forced Locale) |
method_exists('Locale','lookup') |
true |
false ❌ |
Locale::lookup(['de-DE','fr-FR'], 'de-CH', false, 'en_US') |
de_DE (or equiv) |
n/a |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
var_export(function_exists(\"locale_lookup\"));
"'
Done when
Related
Category
stdlib· php-src-strict · child of #3336 / extends Locale surface (#6696)Problem
Locale OOP today covers getDefault/setDefault/getPrimaryLanguage/getRegion/getScript/getDisplayName. Negotiating Accept-Language / preferred locale lists still missing:
Locale::lookup()/locale_lookup()Locale::filterMatches()/locale_filter_matches()Locale::acceptFromHttp()/locale_accept_from_http()method_exists('Locale','lookup')Locale::lookup(['de-DE','fr-FR'], 'de-CH', false, 'en_US')de_DE(or equiv)php-src reference
ext/intl/locale/locale_methods.c—locale_lookup,locale_filter_matches,locale_accept_from_httpuloc_acceptLanguage/ related (v1 may use PHP BCP-47 matching without full ICU)PHP implementation target
ext/intl/VmLocale.php— lookup / filterMatches / acceptFromHttpBuiltinClassesIntlExtensionPolicy::advertisesLocale()(Regression: Locale/NumberFormatter/IntlDateFormatter/IntlCalendar/IntlTimeZone + locale_get_default without ext/intl (re-#16214, ext/intl/php_intl.c) #19670)Repro
Done when
Locale::lookup(['de_DE','fr_FR'], 'de_CH', false, 'en_US')returns German match (php-src-strict shape)Locale::acceptFromHttp('en-US,en;q=0.9,fr;q=0.8')non-empty preferred taglocale_filter_matchestrue/false parity on simple lang/region pairs./script/phpunit.sh --filter LocaleLookupgreenRelated