More style convensions applied, interface updated
[shipsimu.git] / inc / classes / main / language / class_LanguageSystem.php
index 47a7c0b4fa77cd3ff47cd394d606d6e945c4723d..6a830b4420d5ce40a4202c7ac7a39fcc64210f16 100644 (file)
@@ -101,7 +101,7 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
                $langInstance->initLanguageStrings();
 
                // Set language code from default config
-               $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->readConfig("default_lang"));
+               $langInstance->setLanguageCode(FrameworkConfiguration::getInstance()->readConfig('default_lang'));
 
                // Remember this instance
                self::$thisInstance = $langInstance;
@@ -161,6 +161,28 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage {
        public final function getLanguageCode () {
                return $this->langCode;
        }
+
+       /**
+        * Get the plain message from the cache variable for the given message id
+        *
+        * @param       $messageId              The message id we shall find in the cache variable
+        * @return      $messageText    The plain message text
+        */
+       public function getMessage ($messageId) {
+               // Default is missing message text
+               $messageText = sprintf("!%s!",
+                       $messageId
+               );
+
+               // Try to look it up in the cache variable
+               if ($this->langStrings->offsetExists($messageId)) {
+                       // Return the message string
+                       $messageText = $this->langStrings->offsetGet($messageId);
+               }
+
+               // Return the text
+               return $messageText;
+       }
 }
 
 // [EOF]