Each GettextMessageSource instance represents the message translations for a single domain. And each message category represents a message context in Gettext. Translated messages are stored as either a MO or PO file, depending on the [[useMoFile]] property value. All translations are saved under the [[basePath]] directory. Translations in one language are kept as MO or PO files under an individual subdirectory whose name is the language ID. The file name is specified via [[catalog]] property, which defaults to 'messages'.
Since: 2.0
Author: Qiang Xue (qiang.xue@gmail.com)
Inheritance: extends MessageSource
Exemplo n.º 1
0
 /**
  * @inheritdoc
  */
 protected function loadMessages($category, $language)
 {
     if (!isset($this->scopeCache[$category])) {
         if (!is_null($this->scope)) {
             if (strripos($category, $this->scope) === FALSE) {
                 throw new \Exception("Invalid translation category {$category}, not in scope: " . $this->scope);
             }
             $this->scopeCache[$category] = substr($category, strlen($this->scope));
         } else {
             $this->scopeCache[$category] = $category;
         }
     }
     return parent::loadMessages($this->scopeCache[$category], $language);
 }