Monday, October 19, 2009

PHP Web Site Language Settings Variable

This is Part 3 of Visitor Language Detection. Below is the definition for the global language settings variable, $all_language_settings. Part 2 compares this array variable to the HTTP Accept-Language header to decide which language to serve the client. Part 1 discusses how this follows the spec.


/**
* Standard file of Language.Settings.php
*
*
* phpGedView: Genealogy Viewer
* Copyright (C) 2002 to 2007 John Finlay and Others
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License;or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not;write to the Free Software
* Foundation;Inc.;59 Temple Place;Suite 330;Boston;MA 02111-1307 USA
*
* $Id: lang_settings_std.php 2356 2007-12-02 22:30:39Z fisharebest $
*
* @package PhpGedView
* @subpackage Languages
*/

if (stristr($_SERVER["SCRIPT_NAME"], basename(__FILE__))!==false) {
print "You cannot access an include file directly.";
exit;
}

// Array definition of language_settings
$all_language_settings = array();

//-- settings for english
$all_language_settings['en']=array(
'QUALITY'=>'1',
'LANGNAME'=>'English',
'LANG_USE'=>true,
'DATE_FORMAT'=>'D M Y',
'TIME_FORMAT'=>'g:i:sa',
'WEEK_START'=>'0',
'TEXT_DIRECTION'=>'ltr',
'NAME_REVERSE'=>false,
'ALPHABET_upper'=>'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'ALPHABET_lower'=>'abcdefghijklmnopqrstuvwxyz',
'TITLE_WORDS'=>array('of','a','the','and','an','or','nor','but','is','if','then','else', 'when', 'at', 'from', 'by','on','off','for','in','out','over','to','into','with'),
'MULTI_LETTER_ALPHABET'=>'',
'DICTIONARY_SORT'=>true

);

//-- settings for spanish
$all_language_settings['es']=array(
'QUALITY'=>'0.95',
'LANGNAME'=>'español',
'LANG_USE'=>false,
'DATE_FORMAT'=>'D M Y',
'TIME_FORMAT'=>'g:i:sa',
'WEEK_START'=>'0',
'TEXT_DIRECTION'=>'ltr',
'NAME_REVERSE'=>false,
'ALPHABET_upper'=>'ABCDEFGHIJKLMNÑOPQRSTUVWXYZ',
'ALPHABET_lower'=>'abcdefghijklmnñopqrstuvwxyz',
'TITLE_WORDS'=>array(),
'MULTI_LETTER_ALPHABET'=>'',
'DICTIONARY_SORT'=>true
);
?>

No comments: