Changed Configure::read() so it would return null if key is not set.

Refactored I18n and I10n classes.
Removing languages that are not found in browsers

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4117 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-12-21 22:05:42 +00:00
parent 78df4e3549
commit 90a78232ed
3 changed files with 311 additions and 1101 deletions

View file

@ -162,10 +162,16 @@ class Configure extends Object {
$name = $_this->__configVarNames($var); $name = $_this->__configVarNames($var);
if(count($name) > 1){ if(count($name) > 1){
if(isset($_this->{$name[0]}[$name[1]])) {
return $_this->{$name[0]}[$name[1]]; return $_this->{$name[0]}[$name[1]];
}
return null;
} else { } else {
if(isset($_this->{$name[0]})) {
return $_this->{$name[0]}; return $_this->{$name[0]};
} }
return null;
}
} }
/** /**
* Used to delete a var from the Configure instance. * Used to delete a var from the Configure instance.

View file

@ -20,7 +20,7 @@
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake * @package cake
* @subpackage cake.cake.libs * @subpackage cake.cake.libs
* @since CakePHP v 1.2.0.4114 * @since CakePHP v 1.2.0.4116
* @version $Revision$ * @version $Revision$
* @modifiedby $LastChangedBy$ * @modifiedby $LastChangedBy$
* @lastmodified $Date$ * @lastmodified $Date$
@ -93,10 +93,12 @@ class I18n extends Object {
*/ */
function translate($message, $message2 = null, $domain = null, $category = null, $count = null, $directory) { function translate($message, $message2 = null, $domain = null, $category = null, $count = null, $directory) {
$_this =& I18n::getInstance(); $_this =& I18n::getInstance();
$language = Configure::read('Config.language');
if(!empty($_SESSION['Config']['locale'])) { if(!empty($_SESSION['Config']['locale'])) {
$_this->locale = $_SESSION['Config']['locale']; $_this->locale = $_SESSION['Config']['locale'];
} else{ } else{
$_this->__l10n->get($language);
$_this->locale = $_this->__l10n->locale; $_this->locale = $_this->__l10n->locale;
} }

File diff suppressed because it is too large Load diff