當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Locale::getDisplayLocales方法代碼示例

本文整理匯總了PHP中Symfony\Component\Locale\Locale::getDisplayLocales方法的典型用法代碼示例。如果您正苦於以下問題:PHP Locale::getDisplayLocales方法的具體用法?PHP Locale::getDisplayLocales怎麽用?PHP Locale::getDisplayLocales使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Symfony\Component\Locale\Locale的用法示例。


在下文中一共展示了Locale::getDisplayLocales方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: locale

 /**
  * @param $code
  * @param null $locale
  *
  * @return string
  */
 public function locale($code, $locale = null)
 {
     $locales = Locale::getDisplayLocales($locale ?: $this->localeDetector->getLocale());
     if (array_key_exists($code, $locales)) {
         return $this->fixCharset($locales[$code]);
     }
     return '';
 }
開發者ID:ingeniorweb,項目名稱:symfo3cv,代碼行數:14,代碼來源:LocaleHelper.php

示例2: testGetDisplayLocalesReturnsFullListForSubLocale

 public function testGetDisplayLocalesReturnsFullListForSubLocale()
 {
     $this->skipIfIntlExtensionIsNotLoaded();
     $localesDe = Locale::getDisplayLocales('de');
     $localesDeCh = Locale::getDisplayLocales('de_CH');
     $this->assertEquals(count($localesDe), count($localesDeCh));
     $this->assertEquals($localesDe['be'], 'Weißrussisch');
     $this->assertEquals($localesDeCh['be'], 'Weissrussisch');
 }
開發者ID:nicodmf,項目名稱:symfony,代碼行數:9,代碼來源:LocaleTest.php

示例3: getViewData

 /**
  * {@inheritDoc}
  */
 public function getViewData($request)
 {
     $user = $this->getUser();
     $widgets = array();
     $translator = $this->get('translator');
     // WYSIWYG
     $currentEditor = $this->container->get('adminUserPrefService')->getPrefForName($user->getId(), 'wysiwygEditor');
     $widgets[] = Beans::getBean('EditorSelectFormWidget#title=' . $translator->trans('Preferred Editor') . '&value=' . $currentEditor . '&name=wysiwygEditor');
     // uiLocale  (@todo fold into widget)
     $currentLocale = $this->container->get('adminUserPrefService')->getPrefForName($user->getId(), 'uiLocale');
     $locales = Locale::getDisplayLocales($currentLocale);
     $uiLocaleWidget = Beans::getBean('selectFormWidget#name=uiLocale&title=' . $translator->trans('Admin Locale') . '&value=' . $currentLocale);
     foreach ($locales as $locale => $name) {
         // @todo decide whether to show the localized names here at all.
         $uiLocaleWidget->addOption('(' . $locale . ') ' . $name, $locale);
     }
     $uiLocaleWidget->setValue($this->container->get('adminUserPrefService')->getPrefForName($user->getId(), 'uiLocale'));
     $widgets[] = $uiLocaleWidget;
     return array('widgets' => $widgets);
 }
開發者ID:zenmagick,項目名稱:zenmagick,代碼行數:23,代碼來源:UpdateUserController.php

示例4: testGetDisplayLocales

 public function testGetDisplayLocales()
 {
     $locales = Locale::getDisplayLocales('en');
     $this->assertEquals('Portuguese', $locales['pt']);
 }
開發者ID:d3ancole1995,項目名稱:symfony,代碼行數:5,代碼來源:LocaleTest.php

示例5: getDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function getDefaultOptions(array $options)
 {
     return array('choices' => Locale::getDisplayLocales(\Locale::getDefault()), 'value_strategy' => ChoiceList::COPY_CHOICE);
 }
開發者ID:nicodmf,項目名稱:symfony,代碼行數:7,代碼來源:LocaleType.php

示例6: configure

 /**
  * @inheritDoc
  */
 protected function configure()
 {
     $this->addOption('choices', Locale::getDisplayLocales(\Locale::getDefault()));
     parent::configure();
 }
開發者ID:faridos,項目名稱:ServerGroveLiveChat,代碼行數:8,代碼來源:LocaleField.php

示例7: getDefaultOptions

 public function getDefaultOptions(array $options)
 {
     return array(
         'choices' => Locale::getDisplayLocales(\Locale::getDefault()),
     );
 }
開發者ID:nacef,項目名稱:symfony,代碼行數:6,代碼來源:LocaleType.php

示例8: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(array('choices' => Locale::getDisplayLocales(\Locale::getDefault())));
 }
開發者ID:laubosslink,項目名稱:lab,代碼行數:7,代碼來源:LocaleType.php

示例9: getDisplayLocales

 /**
  * Returns the locale names for locale
  *
  * @return array The locale names with their codes as keys
  */
 public function getDisplayLocales()
 {
     return SymfonyLocale::getDisplayLocales($this->getLocale());
 }
開發者ID:ledgr,項目名稱:localefacade,代碼行數:9,代碼來源:LocaleFacade.php

示例10: setDefaultOptions

 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $choices = array_intersect_key(Locale::getDisplayLocales(\Locale::getDefault()), $this->locales);
     $resolver->setDefaults(array('choices' => $choices));
 }
開發者ID:Cohros,項目名稱:KnowledgeBase,代碼行數:8,代碼來源:LocaleType.php


注:本文中的Symfony\Component\Locale\Locale::getDisplayLocales方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。