Automattic / Automattic/wp-cldr

get_territories_contained does not work for non-numeric groupings

Open
#102 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
PHP
Stars
24
Forks
7
PR merge metrics
No merged PRs in 30d

Description

`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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the get_territories_contained method and inspect data/41.0.0/supplemental/territoryContainment.json, especially the EU and EZ entries. Confirm the change lets the method return the territories contained by non-numeric groupings such as EU, then verify the existing behavior for country and numeric-region codes remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
internationalization, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.