Adds wcf\data\language\Language::__toString()
authorMatthias Schmidt <gravatronics@live.com>
Mon, 26 Sep 2011 11:37:48 +0000 (13:37 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 26 Sep 2011 11:37:48 +0000 (13:37 +0200)
Fixes a bug when `LanguageFactory::getInstance()->getLanguages()` is used for html check boxes. Additionally the documentation has been updated a bit.

wcfsetup/install/files/lib/data/language/Language.class.php

index 6bd3ef2666c50deff16c5217a7c17975e513950c..1cf68beb43c9a9da7a4d24ecafffac2b97ce6f29 100644 (file)
@@ -27,32 +27,37 @@ class Language extends DatabaseObject {
        
        /**
         * list of language items
-        * 
-        * @var array
+        * @var array<string>
         */
        protected $items = array();
        
        /**
         * list of dynamic language items
-        * 
-        * @param       array
+        * @var array<string>
         */
        protected $dynamicItems = array();
        
        /**
         * instance of LanguageEditor
-        * 
-        * @var LanguageEditor
+        * @var wcf\data\language\LanguageEditor
         */
        private $editor = null;
        
        /**
-        * Active package id
-        * 
+        * id of the active package
         * @var integer
         */
        public $packageID = PACKAGE_ID;
        
+       /**
+        * Returns the name of this language in the language of the active user.
+        * 
+        * @return      string
+        */
+       public function __toString() {
+               return WCF::getLanguage()->get('wcf.global.language.'.$this->languageCode);
+       }
+       
        /**
         * Returns the fixed language code of this language.
         *