From c2ed9e3429be2062bbb0f058a22f06f5210822ca Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 3 May 2012 08:42:44 -0500 Subject: [PATCH] return key instead of null when language line isn't found. --- laravel/lang.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/laravel/lang.php b/laravel/lang.php index 87be5f3d..de50cef5 100644 --- a/laravel/lang.php +++ b/laravel/lang.php @@ -112,13 +112,18 @@ public static function has($key, $language = null) */ public function get($language = null, $default = null) { + // If no default value is specified by the developer, we'll just return the + // key of the language line. This should indicate which language line we + // were attempting to render and is better than giving nothing back. + if (is_null($default)) $default = $this->key; + if (is_null($language)) $language = $this->language; list($bundle, $file, $line) = $this->parse($this->key); - // If the file doesn't exist, we'll just return the default value that was + // If the file does not exist, we'll just return the default value that was // given to the method. The default value is also returned even when the - // file exists and the file does not actually contain any lines. + // file exists and that file does not actually contain any lines. if ( ! static::load($bundle, $language, $file)) { return value($default);