8000 Missing zh_TW.json in Intl/Resources/data/regions · Issue #21457 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Missing zh_TW.json in Intl/Resources/data/regions #21457

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
lanphy opened this issue Jan 29, 2017 · 22 comments
Closed

Missing zh_TW.json in Intl/Resources/data/regions #21457

lanphy opened this issue Jan 29, 2017 · 22 comments

Comments

@lanphy
Copy link
lanphy commented Jan 29, 2017
Q A
Bug report? yes
Feature request? yes
BC Break report? no
RFC? no
Symfony version 3.2.2

Hi, in the Symfony\Component\Intl\Resources\data\regions directory, there is a missing zh_TW.json file for the list of countries in traditional Chinese caracters (for Taïwan).
I add mine in attach, if that may helps. zh_TW.zip
Thanks,
Lanphy

@javiereguiluz
Copy link
Member
javiereguiluz commented Jan 30, 2017

In the ICU data, zh_TW is defined as an alias:

zh_TW {
    "%%ALIAS"{"zh_Hant_TW"}
}

Maybe there's some issue with aliases? Let's ask to our ICU/Intl expert @jakzal. Thanks!

@xabbuh
Copy link
Member
xabbuh commented Mar 5, 2017

@jakzal Any chance you can help here? :)

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

@lanphy what's the problem you're experiencing? Would you be able to write a snippet of code reproducing the issue?

Is the result of the script below not what you expect?

<?php
// intl.php

require_once __DIR__.'/vendor/autoload.php';

use Symfony\Component\Intl\Intl;

\Locale::setDefault('zh_TW');

$countries = Intl::getRegionBundle()->getCountryNames();

var_dump($countries);

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

Hi, I'm not experiencing an "issue", I'm just notifing that there is a missing file in Symfony package (zh_TW.json), that I have added as attached file here, and offer my suggest to add it in the package.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

We can't just upload the file you sent us, as all of these files are generated out of data provided by ICU.
I'm also not sure where you got the file, since in the most recent ICU version zh_TW is an alias to another locale.

This is why I'm asking if there's any issue you've experienced. Is the list of countries wrong for zh_TW? Does it show data from wrong locale? Otherwise there's nothing to fix here.

@stof
Copy link
Member
stof commented Mar 6, 2017

@lanphy the json files are not meant to be accessed directly. They are used as source by the API of the component. So any fix should be related to an issue with the component API, not just related to looking at the list of files

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

I see. What I experienced is : there is not traditionnal Chinese (Chinese Taiwan) language for the list of countries, only a simplified version one.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

@lanphy which list are you talking about exactly?

@lanphy
Copy link
8000 Author
lanphy commented Mar 6, 2017

The CountryType Field.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

I just verified and Taiwan is on the list of countries:

php intl.php | grep TW
    [TW] => 台湾

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

No, I mean there isn't "Traditionnal Chinese" in the list of translated languages.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

I can see it on the list coming from Intl::getLanguageBundle()->getLanguageNames():

    [zh_Hant] => Traditional Chinese

or with zh_TW locale:

    [zh_Hant] => 繁体中文

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

Yes, but the content seems missing.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

@lanphy you really need to be more specific. What are you trying to do? What's the actual and the expected behaviour?

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

When I want to display the list of countries with CountryType in zh_Hant_TW language, it only displays zh_Hant. So I looked into the library, and as I guessed, there is missing all the zh_Hant_TW labels for the list of countries.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

Ok, could you show me an example of the actual value vs the expected value in the country select? A single key and a single value will do. For example: I see "a => b", but I'd like to see "c => d".

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

Instead of "AD": "安道爾", I get "AD": "安道尔".

@lanphy
Copy link
Author
lanphy commented Mar 6, 2017

If you don't see any issue, it might be my implementation which is not correct.

@jakzal
Copy link
Contributor
jakzal commented Mar 6, 2017

@lanphy thanks, with your help I managed to reproduce the issue. For zh_Hant_TW I see 安道爾, but for zh_TW I see 安道尔 (while the first version should be shown in both cases). So the alias doesn't seem to work properly. I yet need to determine if it's on our side, or ICU.

@fabpot
Copy link
Member
fabpot commented Feb 22, 2018

@jakzal Do you have time to check if the issue is on our side? Thanks.

@jakzal
Copy link
Contributor
jakzal commented Mar 5, 2018

Just did some more debugging and looks like it's on our side. I'm looking into the best way to fix it.

jakzal added a commit that referenced this issue Mar 9, 2018
…zal)

This PR was squashed before being merged into the 2.7 branch (closes #26452).

Discussion
----------

[Intl] Load locale aliases to support alias fallbacks

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21457
| License       | MIT
| Doc PR        | -

For example, `zh_TW` is an alias to `zh_Hant_TW`. Without aliases,` zh_TW` would fall back to `zh` (which is incorrect). With aliases loaded, `zh_TW` will fall back properly to `zh_Hant_TW`.

Judging by git history this has never worked.

```php
\Locale::setDefault('zh'); dump(Intl::getRegionBundle()->getCountryName('AD'));
\Locale::setDefault('zh_TW'); dump(Intl::getRegionBundle()->getCountryName('AD'));
\Locale::setDefault('zh_Hant_TW'); dump(Intl::getRegionBundle()->getCountryName('AD'));
```

Before:

```
"安道尔"
"安道尔"
"安道爾"
```

After:

```
"安道尔"
"安道爾"
"安道爾"
```

All tests are passing, including those from the `intl-data` group.

Commits
-------

1debf79 [Intl] Load locale aliases to support alias fallbacks
@jakzal
Copy link
Contributor
jakzal commented Mar 9, 2018

Fixed by #26452.

@jakzal jakzal closed this as completed Mar 9, 2018
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

7 participants
0