Simple question, I hope: What’s the best/easiest/normal way to convert an ISO code of an country into the country’s translated name (I’m searching for the conversion into German)? Is there some function built in? Or do I need to use an external API? Bonus points for solutions that don’t transfer data to external services, I just need European countries, actually mostly Germany, but ISO codes are not accepted by Mautic as incoming data for the country field.
That is already really easy and helpful, thank you very much.
After playing around and reading little bit more about javascript, I succeeded in translating it into an expression, so I can directly use it in the field “country” to transcode the country-code from DE to the country name Germany:
{{new Intl.DisplayNames(['de'], {type: 'region'}).of($json.country.toUpperCase())}}
Thanks for sharing the js solution @drudge !
Btw @sascha.foerster we have an update to expression editor planned - it should bring autocomplete functions when crafting expressions. So in future I anticipate you’ll be able to do something like {{ myvariable.toISO() }}
.
2 Likes