且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在没有过滤器列表的情况下使用Locale :: acceptFromHttp?

更新时间:2021-09-21 22:13:06

正确的,PHP包装了ICU的uloc_acceptLanguageFromHTTP而没有传递语言环境列表的能力.总体而言,intl扩展是相对较新的(PHP 5.3+),我自己也发现了一些错误,这些错误已在下一发行版中迅速修复.

Correct, PHP wraps ICU's uloc_acceptLanguageFromHTTP without the ability to pass your locale list. Overall, intl extension is relatively new (PHP 5.3+) and I did find a couple of bugs myself which were quickly fixed within the next release.

您可以做的是:

  • Submit a bug/feature request. There is a similar bug already reported.

Accept-Language格式实际上并不那么复杂,我敢打赌,您可以在20行代码中编写自己的解析器.有关示例,请参见本文.

Accept-Language format is really not that complex, I bet you could write your own parser within 20 lines of code. See this article for an example.