1

I'm wondering if there's a build in craft function for displaying countries (countryCode and/or name)?

Just like it is for displaying locales:

craft.i18n.getAllLocales()
1

The closest thing I can think of is to pull the data from the 'territories' part of a craft/app/framework/i18n/data file.

For 'en_us', that would be something like this:

{% set localeData = craft.i18n.getLocaleData('en_us') %}
{% set allTerritories = localeData.getAllTerritories() %}
2
  • How do I know which variable names to use for the "allTerritories" variable from localData.getAllTerritories? A twig {{ dump() }} didn't work. Thanks. Oct 16 '14 at 14:08
  • Disrecard my last comment. Turning on devMode made the "dump" function available. Oct 16 '14 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.