|Last Updated||Ratings||Unique User Downloads||Download Rankings|
|2017-02-25 (1 month ago)||Not enough user ratings||Total: 416||All time: 6,143 This week: 819|
|language-detector 2.1.0||Free To Use But R...||5.0||Localization, HTTP, PHP 5|
This class can detect the preferred language of the user accessing the site.
About ===== This PHP class chooses language based on clues provided in HTTP headers, geolocation and/or a cookie value from an ealier visit. It parses the HTTP Accept Language header for prioritised list of language codes (locales) that are preferred by the client. When Accept Language header is not sent, other clues are used to obtain user's prioritised list of language codes (locales): * The server may know the client's locale. * The server may be able to detect client's country from IP address. This class includes a Country-to_Locale map, and if needed, will map the country code to a list of locales that exist in such country. The resulting prioritised list of locales is then compared against Language-to-Language (locale to locale) map; this will result in arriving at a language code that is most likely to be intellegible by the client while being one of the choices offered by the site's operator. When Accept Language header is not sent and the user is behind anonymous proxy, the fallback will be the default language. The detected language can be optionally stored in a cookie to avoid the need for language detection in subsequent page requests and subsequent site visits. License ======= Copyright 2012-2014 Peter Kahl (www.colossalmind.com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Change Log ========== 2.1.5 ..... 2015-10-25 Added locale for 'BQ', 'CW'. Changed priority order for 'NZ'=>'en,mi'. 2.1.4 ..... 2015-10-25 Added locale for 'SX' Sint Marteen. 2.1.1 ..... 2014-12-02 Changed name of class to better suit class autoloading. 2.1.0 ..... 2014-11-24 Cleaned up. 2.0.1 ..... 2014-11-20 Cleaned up. 2.0.0 ..... 2014-11-18 Completely rewrote, improved the class. Accept Language parser now preserves the order of language code preference (q) as per RFC 2616. Changed license to Apache License, Version 2.0. 1.4.5 ..... 2014-11-14 The default language is best to be placed last in the LANG_MAP array. 1.4.4 ..... 2014-11-08 Fixed bug to properly enable/disable cookie reading/writing. 1.4.3 ..... 2014-11-02 Fixed missing host in setcookie(). Added makecookie() method. 1.4.2 ..... 2014-02-06 Clean up for strict PHP standards. 1.4.1 ..... 2013-10-08 Improved Accept Language parser. 1.4.0 ..... 2013-10-07 Eliminated the requirement that user defines GEO_LANG_MAP (by adding method to detect locale from visitor's country code). 1.3.0 ..... 2013-09-30 Added the ability to parse language codes such as 'zh-Hant-TW'. Added further options for cookie. 1.2.0 ..... 2012-11-05 Converted to PHP5. 1.1.1 ..... 2012-11-02 Added link to repo on GitHub. 1.1.0 ..... 2012-05-27 Added parameter for anonymous proxy. Improved method country_to_language(). 1.0.0 ..... 2012-02-21 Initial release
|Version Control||Unique User Downloads||Download Rankings|