Login   Register  
PHP Classes
elePHPant
Icontem

File: README_EN.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Carlos Falo Hervás  >  lang_detect  >  README_EN.txt  >  Download  
File: README_EN.txt
Role: Documentation
Content type: text/plain
Description: Help file in english
Class: lang_detect
Language setting detection
Author: By
Last change:
Date: 12 years ago
Size: 2,681 bytes
 

Contents

Class file image Download
===== 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