overall code refactoring.

This commit is contained in:
Taylor Otwell
2011-06-14 17:27:11 -05:00
parent af24e8db45
commit 30c83f265d
36 changed files with 720 additions and 559 deletions

View File

@@ -65,8 +65,14 @@ class Lang {
$language = Config::get('application.language');
}
// -----------------------------------------------------
// Parse the key to separate the file and key name.
// -----------------------------------------------------
list($file, $line) = $this->parse($this->key);
// -----------------------------------------------------
// Load the appropriate language file.
// -----------------------------------------------------
$this->load($file, $language);
// --------------------------------------------------------------
@@ -107,6 +113,10 @@ class Lang {
throw new \Exception("Invalid language key [$key].");
}
// --------------------------------------------------------------
// The left side of the dot is the file name, while the right
// side of the dot is the item within that file being requested.
// --------------------------------------------------------------
return array($segments[0], implode('.', array_slice($segments, 1)));
}
@@ -119,6 +129,9 @@ class Lang {
*/
private function load($file, $language)
{
// --------------------------------------------------------------
// If we have already loaded the language file, bail out.
// --------------------------------------------------------------
if (in_array($language.$file, static::$loaded))
{
return;