Skip to content

Commit

Permalink
Allow "symfony/intl:^5"
Browse files Browse the repository at this point in the history
  • Loading branch information
phansys committed Jun 17, 2020
1 parent 6ef2d34 commit 22b1562
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"symfony/dependency-injection": "^4.4",
"symfony/http-foundation": "^4.4",
"symfony/http-kernel": "^4.4",
"symfony/intl": "^4.4",
"symfony/intl": "^4.4 || ^5.0",
"symfony/templating": "^4.4",
"twig/twig": "^2.9"
},
Expand Down
28 changes: 0 additions & 28 deletions src/Templating/Helper/LocaleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
namespace Sonata\IntlBundle\Templating\Helper;

use Symfony\Component\Intl\Countries;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\Languages;
use Symfony\Component\Intl\Locales;

Expand All @@ -33,13 +32,6 @@ class LocaleHelper extends BaseHelper
*/
public function country($code, $locale = null)
{
// NEXT_MAJOR: Remove this when dropping < 4.3 Symfony support
if (!class_exists(Countries::class)) {
$name = Intl::getRegionBundle()->getCountryName($code, $locale ?: $this->localeDetector->getLocale());

return $name ? $this->fixCharset($name) : '';
}

return $this->fixCharset(Countries::getName($code, $locale ?: $this->localeDetector->getLocale()));
}

Expand All @@ -51,19 +43,6 @@ public function country($code, $locale = null)
*/
public function language($code, $locale = null)
{
// NEXT_MAJOR: Remove this when dropping < 4.3 Symfony support
if (!class_exists(Languages::class)) {
$codes = explode('_', $code);

$name = Intl::getLanguageBundle()->getLanguageName(
$codes[0],
$codes[1] ?? null,
$locale ?: $this->localeDetector->getLocale()
);

return $name ? $this->fixCharset($name) : '';
}

return $this->fixCharset(Languages::getName($code, $locale ?: $this->localeDetector->getLocale()));
}

Expand All @@ -75,13 +54,6 @@ public function language($code, $locale = null)
*/
public function locale($code, $locale = null)
{
// NEXT_MAJOR: Remove this when dropping < 4.3 Symfony support
if (!class_exists(Locales::class)) {
$name = Intl::getLocaleBundle()->getLocaleName($code, $locale ?: $this->localeDetector->getLocale());

return $name ? $this->fixCharset($name) : '';
}

return $this->fixCharset(Locales::getName($code, $locale ?: $this->localeDetector->getLocale()));
}

Expand Down

0 comments on commit 22b1562

Please sign in to comment.