Skip to content

Add ISO-3166-1 compliant "GB" alpha-2 code for United Kingdom#115

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-iso-3166-1-code-issue
Draft

Add ISO-3166-1 compliant "GB" alpha-2 code for United Kingdom#115
Copilot wants to merge 3 commits intomainfrom
copilot/fix-iso-3166-1-code-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 20, 2025

Flagpack currently only supports "GB-UKM" (subdivision code) and "GBR" (alpha-3) for the United Kingdom. Per ISO-3166-1, "GB" is the standard alpha-2 code and was not resolving.

Changes

  • Code lists: Added GB entry with alpha3: "GBR", numeric: "836" to src/countryCodeList.ts and countryCodeList.json, positioned before subdivision codes for lookup priority
  • SVG sources: Replaced svg/{s,m,l}/GB.svg with Union Jack (previously contained England flag)
  • Distribution: Added lib/flags/{s,m,l}/{GB,GBR,836}.svg and compiled TypeScript

Backward Compatibility

Existing codes continue to work:

  • GB-UKM → United Kingdom (legacy)
  • GB-ENG, GB-SCT, GB-WLS, GB-NIR → Subdivision flags

Result

// Now works per ISO-3166-1
isoToCountryCode('GB')              // "GB"
isoToCountryCode('GB', 'alpha3')    // "GBR"
isoToCountryCode('GBR')             // "GB"

// Usage in components
<Flag code="GB" />   // ✓ Now displays UK flag
<Flag code="GBR" />  // ✓ Works
Original prompt

Please make a PR that fixes this issue, we should support this case
According to the ISO-3166-1 standard, the alpha-2 country code for the United Kingdom is “GB”, and the alpha-3 code is “GBR”. However, Flagpack does not resolve the alpha-2 code “GB” at all, while “GBR” works correctly.
On your website’s country list, the “2-alpha“ column does not contain the expected ISO-3166-1 alpha-2 code “GB”. Instead, it shows ISO-3166-2 subdivision codes such as:
GB-UKM (United Kingdom)
GB-ENG (England)
GB-SCT (Scotland)
GB-WLS (Wales)
GB-NIR (Northern Ireland)
As a result, calling the component like this:

returns no flag, but:

works correctly.
Could you please confirm whether this is the intended behaviour?
If “GB” is expected to be supported as the ISO alpha-2 code, it would be helpful to add a direct mapping or clarify the documentation. Currently the “2-alpha” column appears to list subdivision codes, which makes the behaviour unclear.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 20, 2025 10:00
Co-authored-by: zoeyfrisart <19853448+zoeyfrisart@users.noreply.github.com>
Co-authored-by: zoeyfrisart <19853448+zoeyfrisart@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ISO-3166-1 support for alpha-2 code GB Add ISO-3166-1 compliant "GB" alpha-2 code for United Kingdom Nov 20, 2025
Copilot AI requested a review from zoeyfrisart November 20, 2025 10:06
@NashJames
Copy link
Copy Markdown

NashJames commented Jan 14, 2026

Hi @zoeyfrisart,

I've opened an issue requesting something like this be merged: #118

Just wondering if there are any updates on when this might be possible?

Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants