예제 #1
0
 public function lookup($key)
 {
     if ($this->translations !== null && $this->translations->hasRows()) {
         foreach ($this->translations->getRows() as $lang) {
             if (trim($lang->original) == trim($key)) {
                 return $lang->translated;
             }
         }
         if ($this->autoCreate) {
             // Save new key for translation
             $lang = new ModelLanguage();
             $lang->original = $key;
             $lang->translated = $key;
             $lang->context = $this->getContext();
             $lang->save();
         }
     }
     return $key;
 }
예제 #2
0
 protected function createCollection(array $items)
 {
     $collection = new ModelCollection($items);
     $collection->setType(static::class);
     return $collection;
 }