8000 [Intl] Missing Kosovo (XK) country name · Issue #40020 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Intl] Missing Kosovo (XK) country name #40020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mmenozzi opened this issue Jan 28, 2021 · 5 comments
Closed

[Intl] Missing Kosovo (XK) country name #40020

mmenozzi opened this issue Jan 28, 2021 · 5 comments

Comments

@mmenozzi
Copy link
Contributor

Symfony version(s) affected: 4.4.17 and 5.5.2 for sure but I think also other versions

Description

When trying to get Kosovo (XK) country name the following fatal error occurs:

PHP Fatal error:  Uncaught Symfony\Component\Intl\Exception\ResourceBundleNotFoundException: The resource bundle "/private/tmp/test/vendor/symfony/intl/Resources/data/regions/root.json" does not exist. in /private/tmp/test/vendor/symfony/intl/Data/Bundle/Reader/JsonBundleReader.php:39
Stack trace:
#0 /private/tmp/test/vendor/symfony/intl/Data/Bundle/Reader/BufferedBundleReader.php(45): Symfony\Component\Intl\Data\Bundle\Reader\JsonBundleReader->read('/private/tmp/te...', 'root')
#1 /private/tmp/test/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php(88): Symfony\Component\Intl\Data\Bundle\Reader\BufferedBundleReader->read('/private/tmp/te...', 'root')
#2 /private/tmp/test/vendor/symfony/intl/ResourceBundle.php(58): Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader->readEntry('/private/tmp/te...', 'en', Array, true)
#3 /private/tmp/test/vendor/symfony/intl/Countries.php(94): Symfony\Component\Intl\ResourceBundle::readEntry(Array, NULL)
#4 /private/tmp/test/test.php(9): Symfony\Component\Intl\Countries::getNa in /private/tmp/test/vendor/symfony/intl/Data/Bundle/Reader/BundleEntryReader.php on line 175

How to reproduce

Execute the following script after a composer require symony/intl:

<?php

require('vendor/autoload.php');

use Symfony\Component\Intl\Countries;

\Locale::setDefault('en');

var_dump(Countries::getName('XK'));
@javiereguiluz
Copy link
Member

I think the reason is that the Republic of Kosovo is not recognized as an official country by the ISO 3166 standard (https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes), which is the one we use to get the list of countries (same as most of other software projects do). That's why it's been included in the "deny list". See

Please keep in mind that in the Symfony project we only focus on tech, so we don't decide what is a country and what isn't. We let those decisions to internationally recognized standards such as ISO 3166. Thanks!

@mmenozzi
Copy link
Contributor Author

Ah yes you're right, I didn't note that Kosovo is not an ISO 3166 country. Thank you!

@ikakarov
Copy link
ikakarov commented Feb 9, 2022

I think the reason is that the Republic of Kosovo is not recognized as an official country by the ISO 3166 standard (https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes), which is the one we use to get the list of countries (same as most of other software projects do). That's why it's been included in the "deny list". See

I think is this a very bad idea. This is not official, but in many cases we need to add some countries like "Kosovo" in projects. In my case i develop ecommerce solution and is very important to add Kosovo like a country in native. I can't see how is possible to develop that because intl rules is not immuttable. Please think about that, because this is very important for all large project when use localization.

@mpdude
Copy link
Contributor
mpdude commented Aug 10, 2022

Same here.

Working on a project for the European Commission where we have a list of countries and country codes we need to support and XK is on it.

Since I don’t see how I could amend or override the list of countries myself, I effectively need to create a wrapper around it to deal with special cases. Now I also need to figure out translations for the country name…

But yeah, probably makes sense for Symfony to just import data from some upstream source and not start maintaining or curating translations from mixed sources.

@Renkas
Copy link
Renkas commented Apr 24, 2024

Same here.

Working on a project for the European Commission where we have a list of countries and country codes we need to support and XK is on it.

Since I don’t see how I could amend or override the list of countries myself, I effectively need to create a wrapper around it to deal with special cases. Now I also need to figure out translations for the country name…

But yeah, probably makes sense for Symfony to just import data from some upstream source and not start maintaining or curating translations from mixed sources.

I would argue that it would be important that library like Symfony would deal with this instead of letting every project/developer stumble upon this problem at some time themselves and then implement their own hack to get things working in real world.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
0