Esempio n. 1
0
 public function asLanguage($value)
 {
     if ($value == null) {
         return $this->nullDisplay;
     }
     return LanguageBuilder::build($value)->title;
 }
Esempio n. 2
0
 public function availableLanguages()
 {
     if (!$this->isMultiLanguage()) {
         return [];
     }
     foreach ($this->languages as $language) {
         $output[] = LanguageBuilder::build($language);
     }
     return $output;
 }
 private static function setDependencies()
 {
     Yii::$container->set('language', 'kalpok\\i18n\\Language');
     Yii::$container->setSingleton('kalpok\\i18n\\Language', function () {
         return LanguageBuilder::build(Yii::$app->language);
     });
     Yii::$container->set('calendar', 'kalpok\\i18n\\Calendar');
     Yii::$container->setSingleton('kalpok\\i18n\\Calendar', function () {
         return CalendarBuilder::build(Yii::$app->language);
     });
 }