Skip to content
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

get_territories_contained does not work for non-numeric groupings #102

Open
bluefuton opened this issue Feb 12, 2024 · 0 comments
Open

get_territories_contained does not work for non-numeric groupings #102

bluefuton opened this issue Feb 12, 2024 · 0 comments

Comments

@bluefuton
Copy link

get_territories_contained, which lists territories within a region or grouping, makes two assumptions:

  • a 2 letter code is always a country (e.g. DE)
  • a 3 digit number is always a region (e.g. 150)

The data also contains groupings like 'EU', 'EZ' (Eurozone) which have two letters. This means it's not possible to get a list of EU countries like this:

$locale = 'de';
$cldr = new WP_CLDR( $locale );
$eu_countries = $cldr->get_territories_contained( 'EU' );

It would be useful if get_territories_contained could return this too - perhaps by validating what keys are available in the JSON file instead.

https://github.com/Automattic/wp-cldr/blob/master/data/41.0.0/supplemental/territoryContainment.json

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

1 participant