Exemple #1
0
 /**
  * Translates a code into the selected locale's definition.
  *
  * @param string $Code The code related to the language-specific definition.
  *   Codes thst begin with an '@' symbol are treated as literals and not translated.
  * @param string $Default The default value to be displayed if the translation code is not found.
  * @return string
  */
 public function Translate($Code, $Default = FALSE)
 {
     if ($Default === FALSE) {
         $Default = $Code;
     }
     // Codes that begin with @ are considered literals.
     if (substr_compare('@', $Code, 0, 1) == 0) {
         return substr($Code, 1);
     }
     $Translation = $this->LocaleContainer->Get($Code, $Default);
     // If developer mode is on, and this translation returned the default value,
     // remember it and save it to the developer locale.
     if ($this->DeveloperMode && $Translation == $Default) {
         $DevKnows = $this->DeveloperContainer->Get($Code, FALSE);
         if ($DevKnows === FALSE) {
             $this->DeveloperContainer->SaveToConfig($Code, $Default);
         }
     }
     return $Translation;
 }