In the application we use country_option_tags to generate a select with a list of countries. According to the documentation:
Creates an <option> tag for each country and region that's included in a shipping zone on the Shipping page of the Shopify admin.
An attribute called data-provinces is set for each <option>, and contains a JSON-encoded array of the country or region's subregions. If a country doesn't have any subregions, then an empty array is set for its data-provinces attribute.