Commits

Harro Verton committed c5e153e

Added a Datamapper specific Lang class extension, to avoid not-found errors. Fixes #47.

  • Participants
  • Parent commits f806c20

Comments (0)

Files changed (1)

File application/libraries/datamapper.php

 		$CI =& get_instance();
 		if ($CI)
 		{
-			$this->lang = $CI->lang;
+			if ( ! isset($CI->dm_lang))
+			{
+				$CI->dm_lang = new DM_Lang();
+			}
+			$this->lang = $CI->dm_lang;
 			$this->load = $CI->load;
 			$this->config = $CI->config;
 		}
 }
 
 
+/**
+ * Hack into the Lang core class
+ *
+ * @package DMZ
+ */
+class DM_Lang extends CI_Lang
+{
+	/**
+	 * Fetch a single line of text from the language array
+	 *
+	 * @access	public
+	 * @param	string	$line	the language line
+	 * @return	string
+	 */
+	function line($line = '')
+	{
+		$value = ($line == '' OR ! isset($this->language[$line])) ? FALSE : $this->language[$line];
+		return $value !== FALSE ? $value : $line;
+	}
+}
+
+
 // --------------------------------------------------------------------------
 
 /**