|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-09-20 05:17 UTC] i at walkinraven dot name
Description: ------------ Locale::acceptFromHttp could only returns with a string. But HTTP Accept-Language could offer more than one language tag with priority. Why not to return an number-ordered-array like: array ( 0 => language tag 1, 1 => language tag 2, ... ) Ordered with priority offered by HTTP? PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 01:00:02 2025 UTC |
At least this yes. But in each application we will have a code that looks similar to this: $supportedLanguages = ['de_DE','en_US']; foreach (Loacle::acceptFromHttp as $locale) { if (in_array($locale, $supportedLocales)) { return $locale; } } return $defaultLocale; Why a acceptFromHttp if it is useless? The best matching is not useful at all. A list of matching locales is at least useful. But even better will be a function that gives the locale we want to use: public static function acceptFromHttp($header, $supportedLocales, $defaultLocale)