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


PHP Zend_Locale::isAlias方法代码示例

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


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

示例1: testAliases

 /**
  * Test that locale names that have been dropped from CLDR continue to
  * work.
  */
 public function testAliases()
 {
     $locale = new Zend_Locale('zh_CN');
     $this->assertEquals(true, $locale->isLocale('zh_CN'));
     $this->assertEquals('zh', $locale->getLanguage());
     $this->assertEquals('CN', $locale->getRegion());
     $this->assertEquals(true, Zend_Locale::isAlias($locale));
     $this->assertEquals(true, Zend_Locale::isAlias('zh_CN'));
     $this->assertEquals('zh_Hans_CN', Zend_Locale::getAlias('zh_CN'));
     $locale = new Zend_Locale('zh_Hans_CN');
     $this->assertEquals(true, $locale->isLocale('zh_Hans_CN'));
     $this->assertEquals('zh', $locale->getLanguage());
     $this->assertEquals('CN', $locale->getRegion());
     $this->assertEquals(false, Zend_Locale::isAlias('zh_Hans_CN'));
     $this->assertEquals('zh_Hans_CN', Zend_Locale::getAlias('zh_Hans_CN'));
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:20,代码来源:LocaleTest.php

示例2: _checkLocale

 /**
  * Internal function for checking the locale
  *
  * @param  string|Zend_Locale $locale Locale to check
  * @return string
  * @throws Zend_Locale_Exception
  */
 private static function _checkLocale($locale)
 {
     if (empty($locale)) {
         $locale = new Zend_Locale();
     }
     if (!Zend_Locale::isLocale((string) $locale, null, false)) {
         // require_once 'Zend/Locale/Exception.php';
         throw new Zend_Locale_Exception("Locale (" . (string) $locale . ") is a unknown locale");
     }
     if (Zend_Locale::isAlias($locale)) {
         // Return a valid CLDR locale so that the XML file can be loaded.
         return Zend_Locale::getAlias($locale);
     }
     return (string) $locale;
 }
开发者ID:sadikeser,项目名称:tickets,代码行数:22,代码来源:Data.php

示例3: getLabels

 /**
  * Get all labels of the attributes
  *
  * @return string[] with 'locale' => 'label'
  */
 public function getLabels()
 {
     if (isset($this->_labels)) {
         return $this->_labels;
     }
     $labelsNode = $this->_xmlElement->{'labels'};
     $labels = [];
     if ($labelsNode->count() > 0) {
         foreach ($labelsNode->children() as $labelNode) {
             /** @var SimpleXmlElement $labelNode */
             $locale = $labelNode->getName();
             if (Zend_Locale::isAlias($locale)) {
                 $locale = Zend_Locale::getAlias($locale);
             }
             $label = (string) $labelNode;
             $labels[$locale] = $label;
         }
     }
     $this->_labels = $labels;
     return $labels;
 }
开发者ID:aoepeople,项目名称:aoe_attributeconfigurator,代码行数:26,代码来源:Attribute.php


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