Pluf Framework

Pluf Framework Commit Details


Date:2009-10-07 07:53:35 (15 years 2 months ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:490e44385f0b99641983e38abf66fbb33db7a885
Parents: 6f2a8e11ea6057fc49f6d17205f6e7487b944176
Message:Refactored the loading of the translation files.

Changes:

File differences

src/Pluf.php
4040
4141
4242
43
4344
4445
4546
$GLOBALS['_PX_starttime'] = microtime(true);
$GLOBALS['_PX_uniqid'] = uniqid($GLOBALS['_PX_starttime'], true);
$GLOBALS['_PX_signal'] = array();
$GLOBALS['_PX_locale'] = array();
Pluf::loadConfig($config);
date_default_timezone_set(Pluf::f('time_zone', 'Europe/Berlin'));
mb_internal_encoding(Pluf::f('encoding', 'UTF-8'));
src/Pluf/Middleware/Translation.php
5858
5959
6060
61
62
63
64
65
66
67
68
61
6962
7063
7164
// will default to 'en'
$lang = Pluf_Translation::getAcceptedLanguage(Pluf::f('languages', array('en')));
}
$GLOBALS['_PX_current_locale'] = $lang;
$GLOBALS['_PX_locale'] = array();
$GLOBALS['_PX_locale'][$lang] = array();
foreach (Pluf::f('installed_apps') as $app) {
if (false != ($pofile=Pluf::fileExists($app.'/locale/'.$lang.'/'.strtolower($app).'.po'))) {
$GLOBALS['_PX_locale'][$lang] += Pluf_Translation::readPoFile($pofile);
}
}
Pluf_Translation::loadSetLocale($lang);
$request->language_code = $lang;
return false;
}
src/Pluf/Translation.php
5252
5353
5454
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
5574
5675
5776
'de' => 'plural_2not1',
);
public static function loadSetLocale($lang)
{
$GLOBALS['_PX_current_locale'] = $lang;
if (isset($GLOBALS['_PX_locale'][$lang])) {
return; // We consider that it was already loaded.
}
$GLOBALS['_PX_locale'][$lang] = array();
foreach (Pluf::f('installed_apps') as $app) {
if (false != ($pofile=Pluf::fileExists($app.'/locale/'.$lang.'/'.strtolower($app).'.po'))) {
$GLOBALS['_PX_locale'][$lang] += Pluf_Translation::readPoFile($pofile);
}
}
}
public static function getLocale()
{
return $GLOBALS['_PX_current_locale'];
}
/**
* Get the plural form for a given locale.
*/

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.06269s using 13 queries.