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

Utility for conversting countries and state/provinces to different alphas #68

Open
chorton opened this issue Nov 15, 2018 · 1 comment
Labels
Milestone

Comments

@chorton
Copy link

chorton commented Nov 15, 2018

Would it be possible to take a country and/or state/province that I already have that uses the full names and convert that with this package to the alpha-2 / short value? I want to use the short values in the dropdowns, so I need a way to convert my given address to the short value I can pass to the component. Thoughts?

@benkeen
Copy link
Member

benkeen commented Nov 16, 2018

Hey @chorton, fiddly one! I'm afraid this really needs to be a custom task you'll need to do on your end. A key component of this would be for you to get the full list of countries/province (your own strings) and for that you really need to first gather them up and put them into a convenient data structure (probably JSON). At that point you could handle the conversion.

The data source of the country/regions used by this repo is here:
https://github.com/country-regions/country-region-data

It contains a data.json file, which is exceedingly easy to parse the data you need.

Sorry I couldn't be more help - as I said: fiddly one!

@benkeen benkeen added this to the 4.1.0 milestone Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants