コード例 #1
0
ファイル: Manager.php プロジェクト: stuartherbert/mf
 /**
  * get a translated version of a string
  *
  * @param string $module The name of the module where this string
  *        is defined
  * @param string $stringName The name of the string we want a
  *        translation for
  * @return string The translated string, or the name of the token
  *                that needs translating
  */
 public function getTranslation($module, $stringName)
 {
     // step 1 - get the translation from the app's current
     //          language
     $return = $this->currentLanguage->getTranslation($module, $stringName);
     if ($return) {
         return $return;
     }
     // step 2 - check the default language strings if the string
     //          we seek hasn't been translated for the app's
     //          current language
     $return = $this->defaultLanguage->getTranslation($module, $stringName);
     if ($return) {
         return $return;
     }
     // step 3 - still no translation? return the token then
     $return = $module . '::' . $stringName;
     return $return;
 }
コード例 #2
0
ファイル: Language.classes.php プロジェクト: stuartherbert/mf
 /**
  * get a translated version of a string
  *
  * @param string $module The name of the module where this string
  *        is defined
  * @param string $stringName The name of the string we want a
  *        translation for
  * @return string The translated string, or the name of the token
  *                that needs translating
  */
 public function getTranslation($module, $stringName)
 {
     // step 1 - do we have a translation for this string?
     if (!$this->currentLanguage->hasTranslationsForModule($module)) {
         // we need to autoload the translations
         $this->autoloadTranslationsForModule($module);
     }
     // step 2 - get the translation from the app's current
     //          language
     $return = $this->currentLanguage->getTranslation($module, $stringName);
     if ($return) {
         return $return;
     }
     // step 3 - check the default language strings if the string
     //          we seek hasn't been translated for the app's
     //          current language
     $return = $this->defaultLanguage->getTranslation($module, $stringName);
     if ($return) {
         return $return;
     }
     // step 3 - still no translation? return the token then
     $return = $module . '::' . $stringName;
     return $return;
 }