Exemplo n.º 1
0
 /**
  * @param  \ServerGrove\KbBundle\Document\Article $article
  * @param  string                                 $locale
  * @return string
  */
 public function renderArticleLocale(Article $article, $locale)
 {
     try {
         $active = $this->manager->findTranslation(get_class($article), $article->getId(), $locale, false)->getIsActive();
     } catch (\InvalidArgumentException $e) {
         $active = false;
     }
     $this->manager->refresh($article);
     return $this->twig->renderBlock('article_locale', array('active' => $active, 'locale' => $locale, 'locale_name' => Locale::getDisplayLanguage($locale)));
 }
 /**
  * Display language
  *
  * @return string
  */
 public function displayLanguage()
 {
     return Locale::getDisplayLanguage($this->getLang());
 }
Exemplo n.º 3
0
 /**
  * @param  array $locales
  * @return array
  */
 private function getLocaleNames(array $locales)
 {
     $names = array_map(function ($locale) {
         return array('name' => Locale::getDisplayLanguage($locale));
     }, $locales);
     return array_combine($locales, $names);
 }