当前位置: 首页>>代码示例>>PHP>>正文


PHP Locale::getDisplayLanguages方法代码示例

本文整理汇总了PHP中Symfony\Component\Locale\Locale::getDisplayLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP Locale::getDisplayLanguages方法的具体用法?PHP Locale::getDisplayLanguages怎么用?PHP Locale::getDisplayLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Locale\Locale的用法示例。


在下文中一共展示了Locale::getDisplayLanguages方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDisplayLanguage

 /**
  * Get language name
  *
  * @param  string $code
  * @return string
  */
 public function getDisplayLanguage($code)
 {
     $languages = Locale::getDisplayLanguages($this->request->getLocale());
     if (isset($languages[$code])) {
         return $languages[$code];
     }
 }
开发者ID:yoye,项目名称:localizationbundle,代码行数:13,代码来源:Localizer.php

示例2: saveSettings

 /**
  * @Route("/admin/settings/save/{formType}", name="cuteflow_admin_settings_save")
  * @Template("CuteFlowCoreBundle:Admin:settings.html.twig")
  * 
  * @param string $formType
  * @return void
  */
 public function saveSettings($formType)
 {
     $em = $this->getDoctrine()->getEntityManager();
     $settings = $em->find('CuteFlowCoreBundle:Settings', 1);
     if ($settings == null) {
         $settings = new \CuteFlow\CoreBundle\Entity\Settings();
     }
     $localeNames = Locale::getDisplayLanguages($this->getRequest()->getSession()->getLocale());
     $availableLanguages = array_intersect_key($localeNames, $this->container->getParameter('cuteflow.languages'));
     $generalForm = $this->createForm(new SettingsGeneralType(), $settings);
     $emailForm = $this->createForm(new SettingsEmailType(), $settings);
     switch ($formType) {
         case 'email':
             $form = $emailForm;
             break;
         case 'general':
             $form = $generalForm;
             break;
     }
     $success = false;
     $form->bindRequest($this->getRequest());
     if ($form->isValid()) {
         $em->persist($settings);
         $em->flush();
         $success = true;
     }
     return array('generalForm' => $generalForm->createView(), 'emailForm' => $emailForm->createView(), 'availableLanguages' => $availableLanguages, 'formType' => $formType, 'saveSuccess' => $success, 'form' => $form->createView());
 }
开发者ID:robertowest,项目名称:CuteFlow-V4,代码行数:35,代码来源:AdminController.php

示例3: language

 /**
  * @param $code
  * @param null $locale
  *
  * @return string
  */
 public function language($code, $locale = null)
 {
     $languages = Locale::getDisplayLanguages($locale ?: $this->localeDetector->getLocale());
     if (array_key_exists($code, $languages)) {
         return $this->fixCharset($languages[$code]);
     }
     return '';
 }
开发者ID:ingeniorweb,项目名称:symfo3cv,代码行数:14,代码来源:LocaleHelper.php

示例4: testGetDisplayLanguagesReturnsFullListForSubLocale

 public function testGetDisplayLanguagesReturnsFullListForSubLocale()
 {
     $this->skipIfIntlExtensionIsNotLoaded();
     $languagesDe = Locale::getDisplayLanguages('de');
     $languagesDeCh = Locale::getDisplayLanguages('de_CH');
     $this->assertEquals(count($languagesDe), count($languagesDeCh));
     $this->assertEquals($languagesDe['be'], 'Weißrussisch');
     $this->assertEquals($languagesDeCh['be'], 'Weissrussisch');
 }
开发者ID:nicodmf,项目名称:symfony,代码行数:9,代码来源:LocaleTest.php

示例5: configure

 /**
  * @inheritDoc
  */
 protected function configure()
 {
     $this->addOption('choices', Locale::getDisplayLanguages($this->locale));
     parent::configure();
 }
开发者ID:rosstuck,项目名称:Pok,代码行数:8,代码来源:LanguageField.php

示例6: testGetDisplayLanguages

 public function testGetDisplayLanguages()
 {
     $languages = Locale::getDisplayLanguages('en');
     $this->assertEquals('Brazilian Portuguese', $languages['pt_BR']);
 }
开发者ID:d3ancole1995,项目名称:symfony,代码行数:5,代码来源:LocaleTest.php

示例7: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('choices' => Locale::getDisplayLanguages(\Locale::getDefault())));
 }
开发者ID:laubosslink,项目名称:lab,代码行数:7,代码来源:LanguageType.php

示例8: getDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function getDefaultOptions(array $options)
 {
     return array('choices' => Locale::getDisplayLanguages(\Locale::getDefault()));
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:7,代码来源:LanguageType.php

示例9: getCountryLanguages

 /**
  * {@inheritdoc}
  */
 public function getCountryLanguages($language)
 {
     return $this->locale->getDisplayLanguages($language);
 }
开发者ID:fkomaralp,项目名称:country-list,代码行数:7,代码来源:Icu.php

示例10: getDisplayLanguages

 /**
  * Returns the language names for locale
  *
  * @return array The language names with their codes as keys
  */
 public function getDisplayLanguages()
 {
     return SymfonyLocale::getDisplayLanguages($this->getLocale());
 }
开发者ID:ledgr,项目名称:localefacade,代码行数:9,代码来源:LocaleFacade.php

示例11: getDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function getDefaultOptions(array $options)
 {
     return array('choices' => Locale::getDisplayLanguages(\Locale::getDefault()), 'value_strategy' => ChoiceList::COPY_CHOICE);
 }
开发者ID:nicodmf,项目名称:symfony,代码行数:7,代码来源:LanguageType.php


注:本文中的Symfony\Component\Locale\Locale::getDisplayLanguages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。