Recommend this page to a friend! |
Download .zip |
Info | View files (3) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2002-06-21 (14 years ago) | 49% | Total: 2,567 | All time: 1,443 This week: 1,113 |
Version | License | Categories | ||||
lang_detect 1.0 | GNU General Publi... | Localization |
Description | Author | ||||||||||||||
Allows to find out the client's browser language settings and check for given locales in those settings |
|
===== BASIC DOCUMENTATION FOR LANG DETECT CLASS ===== 0.- INTRODUCTION This Class is designed to check for the user's language preferences and to match for given locales. NOTES: All locales are composed by 3 elements: PREFIX-SUBCLASS ; QUALITY=value PREFIX: is the main language identifier (i.e. en-us, en-ca,... have prefix EN) SUBCLASS: is a subdivision for main language (prefix) (i.e. en-us runs for english - united states) IT CAN BE BLANK QUALITY: is the importance for given language... primary language setting defaults to 1 (100%), normally secondary and further selections have a lower Q value (value <1). 1.- INTERFACE The public interface for the class is formed by: PUBLIC VARIABLES: $langs: Counter for the number of accepted languages in the client's browser $lang_list: List of the accepted languages. PAIRS $locale => Q*100 PUBLIC FUNCTIONS: lang_detect() CONSTRUCTOR: Initialize the language list is_primarylang($locale) Returns 1 if the PREFIX for $locale matches the PREFIX for the primary language selected by the user $locale -> locale string get_primarylang() Returns the full locale string for the client's primary language selection get_primaryprefix() Returns the PREFIX string for the client's primary language selection find_lang($loc) Retunrs QUALITY for PREFIX in given $loc (QUALITY = q*100 -> percent) $loc -> locale string get_list($arr,&$sublist) Fills $sublist with an array of matching locales from $arr in the clients language selection ordered by QUALITY (DESC). $arr -> An array with the locales to match &$sublist -> destination array (it is converted to array internally) EXAMPLE: Imagine a language selection of en, es; q=0.5, fr; q=0.3 Calling get_list with $arr = Array("de","en","es) fills $sublist with: "en" => 100 , "es" => 50 print_list() Echo to screen a list for the users language selections (this is a debug function, basically useful for testing) 2.- Future releases and WIP This class will not have many revisions as it is fully functional for it's intended use. For furtehr developement any suggestions are wellcome 3.- Contact information Carlos Falo Hervás carles@bisinteractive.net http://www.bisinteractive.net C/Manila 54-56 Esc. A Ent. 4ª 08034 Barcelona Spain Phone: +34 9 3 2063652 Fax: +34 9 3 2063689 |
Files |
File | Role | Description |
---|---|---|
language.class.php | Class | base class |
LICENSE | Doc. | GNU GPL License |
README_EN.txt | Doc. | Help file in english |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
User Ratings | ||||||||||||||||||||||||||||||
|
Applications that use this package |
Nasker International Snacks Pet-food SL Multiple language site based on this class and MSGCAT class, most pages are dinamically transtaled based on lang. settings |
PHPOpenChat PHPOpenChat is a high performance php-based chat server software for a live chat-room or -module on every php-based site. |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
Message Catalog class in PHPClasses A handy class to use along lang detect to generate multiple language sites |