Switch to symfony/translation for translations (#250)
This commit is contained in:
parent
0b1ce90f47
commit
a5bd827d21
16 changed files with 399 additions and 212 deletions
|
@ -38,7 +38,9 @@ class Locale
|
|||
{
|
||||
$parse = AcceptLanguage::parse($locale);
|
||||
$this->language = $parse[1]['language'];
|
||||
$this->region = $parse[1]['region'];
|
||||
if (!empty($parse[1]['region'])) {
|
||||
$this->region = $parse[1]['region'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +70,11 @@ class Locale
|
|||
*/
|
||||
public function getIso15897()
|
||||
{
|
||||
return $this->language . '_' . $this->region;
|
||||
if (isset($this->region)) {
|
||||
return $this->language . '_' . $this->region;
|
||||
} else {
|
||||
return $this->language;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,7 +84,11 @@ class Locale
|
|||
*/
|
||||
public function getBcp47()
|
||||
{
|
||||
return $this->language . '-' . $this->region;
|
||||
if (isset($this->region)) {
|
||||
return $this->language . '-' . $this->region;
|
||||
} else {
|
||||
return $this->language;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,6 +108,8 @@ class Locale
|
|||
*/
|
||||
public function getCountry()
|
||||
{
|
||||
return country($this->getIso3166());
|
||||
if (isset($this->region)) {
|
||||
return country($this->getIso3166());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue