本文整理匯總了PHP中Symfony\Component\Locale\Locale::getDefault方法的典型用法代碼示例。如果您正苦於以下問題:PHP Locale::getDefault方法的具體用法?PHP Locale::getDefault怎麽用?PHP Locale::getDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Locale\Locale
的用法示例。
在下文中一共展示了Locale::getDefault方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getIntlDateFormater
/**
*
* @param type $format
* @return \IntlDateFormatter
* @throws Exception
*/
protected function getIntlDateFormater($format)
{
if (\is_string($format)) {
$format = \constant('\\IntlDateFormatter::' . \strtoupper($format));
} else {
if (!\is_numeric($format)) {
throw new Exception('Format must be an string or IntlDateFormater Int Value');
}
}
$locale = \Symfony\Component\Locale\Locale::getDefault();
$tz = $this->userManager->getTimezone();
$fmt = new \IntlDateFormatter($locale, $format, $format, $tz->getName(), \IntlDateFormatter::GREGORIAN);
return $fmt;
}
示例2: thereIsCountry
/**
* @Given /^I created country "([^""]*)"$/
* @Given /^there is country "([^""]*)"$/
*/
public function thereIsCountry($name, $provinces = null, $flush = true)
{
/* @var $country CountryInterface */
if (null === ($country = $this->getRepository('country')->findOneBy(array('name' => $name)))) {
$country = $this->getRepository('country')->createNew();
$country->setName(trim($name));
$country->setIsoName(array_search($name, Locale::getDisplayCountries(Locale::getDefault())));
if (null !== $provinces) {
$provinces = $provinces instanceof TableNode ? $provinces->getHash() : $provinces;
foreach ($provinces as $provinceName) {
$country->addProvince($this->thereisProvince($provinceName));
}
}
$manager = $this->getEntityManager();
$manager->persist($country);
if ($flush) {
$manager->flush();
}
}
return $country;
}
示例3: localizeName
private function localizeName($name, $locale = null)
{
return ($locale or $locale = Locale::getDefault()) ? $name . '.' . $locale : $name;
}