MIT · TypeScript, Swift, Kotlin · version 1.0.0
locale-atlas
Every country’s flag, names and currencies, and lists of countries. The same answer on the web, in Swift and on Android.
$ npm install locale-atlas- 0
- dependencies, on every platform
- 258
- country codes: ISO 3166-1’s 249, Kosovo, 8 reserved
- 197
- currencies, three symbols each: USD, US$, $
- 10
- languages for the names of countries and currencies
What it carries
Flags
One for each of its country codes, the European Union’s included. Whole squares, each cut so a circle shows what makes the flag that flag (the emblem, the canton, the triangle at the hoist), in plain paths that browsers, iOS and Android draw alike.
Each currency’s flag
Each currency code to the region whose flag it shows, by one rule: the one place it is issued for, where it is legal tender; the euro has the European Union’s. UYU → UY, GGP → GG, EUR → EU. A currency several places share (XAF, XPF) or nobody’s, the units of account and fund codes (UI, UYI, CLF…), and Transnistria’s and Somaliland’s give null, never a guessed flag.
Countries
Every ISO 3166-1 code, Kosovo and the codes ISO reserves for the EU, the UN and a few places, with alpha-3 and numeric codes, emoji, official languages, currencies, calling codes, internet domain, continent and IANA time zones.
Currencies
ISO 4217’s in use, the market’s own (CNH, GGP…), the units of account (UI, UP, UR…) and the withdrawn codes the market still quotes, each with its minor units and three symbols: USD, US$ and $; UYU, $U and $.
Names
Every country’s and currency’s name in ten languages: English, Spanish, Brazilian Portuguese, French, Italian, German, Russian, Arabic and Chinese, simplified and traditional. One file each, so an app carries the ones it shows; the user’s is picked the same way on every platform, and a name a language lacks is English’s. And each country’s names in its own official languages.
Collections
Lists of countries, to support only some or leave some out: regions, blocs and each authority’s sanctions, each list with the line its definition draws, its sources and the day it was last checked. The app names the lists to include and to leave out, and gets its countries.
Next: number and date separators. Until then, use each platform’s own (Intl, NumberFormatter, NumberFormat).
The collections
Which countries an app supports, or leaves out, as a list it imports instead of one it keeps by hand.
Regions and blocs
Where a product is sold, where people sign up, where it ships: continents, regions and the blocs countries belong to.
- Southern Cone
- South America
- Latin America
- Central America
- Caribbean
- Mercosur
- European Union
- Eurozone
- Schengen Area
- USMCA
- OECD
- G20
Sanctions
Each authority’s sanctions, from an embargo to an arms embargo or a list of people. Each list says where it draws the line, its sources and the day it was last checked against them; the EU’s widest counts any regime about a country, dormant ones included.
- United States: embargo
- United States: partial
- European Union
- UN Security Council
The sanctions lists are a place to start, not legal advice: sanctions also reach people, sectors and regions, and these lists hold only countries. Check the authority’s own, with your lawyer, before you rely on one.
The platforms
Web
Browsers, Node 22.13+, Deno, Bun, Workers and any bundler
SVG files, and the data as ES modules, one per part and per language, so a bundler keeps only those a page uses: the flag functions under 2 kB minified and gzipped, a language’s names about 5 kB.
npm install locale-atlasOr nothing to install: jsDelivr serves every file,
cdn.jsdelivr.net/npm/[email protected]/flags/UY.svg.iOS · macOS
iOS 15+, macOS 12+, tvOS 15+, watchOS 8+, visionOS
An asset catalog and the data as JSON, in the module’s own bundle; each file is decoded the first time it is asked for.
.package(url: "https://github.com/guillecura/locale-atlas", from: "1.0.0")Or in Xcode, File › Add Package Dependencies… with the repository. The product is
LocaleAtlas.Android
Android 7.0+ (API 24), Kotlin 2.1+
Vector drawables prefixed
locale_atlas_, and the data as JSON, read with the platform’sorg.jsonthe first time it is asked for.implementation("com.github.guillecura:locale-atlas:v1.0.0")From JitPack, with
maven("https://jitpack.io")among the repositories.
Every platform gets the same data and the same drawings, made once from one source, at the same version. Pin it: a new release may redraw a flag or rename a country.
With your agent
The package ships a skill for your agent: which module for where the code runs, the calls for a flag, a picker, a symbol or the countries an app serves, and the rules: names fall back to English, the data is dated, and a sanctions collection follows one authority and is not legal advice.
Put it in your project:
$ npx locale-atlas skillClaude Code reads it when the task calls for it.
- In Claude Code, as a plugin
- /plugin marketplace add guillecura/skills /plugin install locale-atlas@whitebear
- For another agent
- npx locale-atlas skill --dir .agents/skills
- Without installing the package
- npx skills add guillecura/locale-atlas
Show each currency’s flag in the picker, round.
Uses
currencyFlagUrl,Flag.currencyorLocaleAtlas.currencyFlagand clips the square where it draws it; a currency with no flag keeps its code.Don’t offer sign-up in countries under a US embargo.
Builds the list with
supported, leaving outsanctions-us-comprehensive, and tells you the day that list was last checked: a starting point for your lawyer, not legal advice.Put a country picker on the sign-up form, in the user’s language, with flags and calling codes.
Names each country with
names(navigator.languages),Names.currentorLocaleAtlas.names(), sorts the list by the name shown with the platform’s collation, and puts each one’s round flag andcallingCodesbeside it.
In your code
The same lookups on the three, by ISO code in any case. A code it doesn’t know gives null, never an error; only a collection that doesn’t exist throws, so a typo never serves a sanctioned country.
atlas.ts
import { country, currency, currencyFlagUrl, names, supported } from "locale-atlas";
const uy = country("UY"); // or "uy", "URY", "858"; null for a code it doesn't know
uy?.emoji; // "🇺🇾"
uy?.callingCodes; // ["+598"]
uy?.timezones; // ["America/Montevideo"]
currency("UYU")?.symbols; // { code: "UYU", international: "$U", local: "$" }
// Names in the user's language, the first of theirs it has: ["es-UY", "en"] → Spanish
const n = await names(navigator.languages);
n.country("BR"); // "Brasil"
n.currency("UYU"); // "peso uruguayo"
// A store in Latin America, but not where the US sanctions
supported({ include: ["latin-america"], exclude: ["sanctions-us-comprehensive"] });
currencyFlagUrl("UYU"); // "https://cdn.jsdelivr.net/npm/[email protected]/flags/UY.svg"
currencyFlagUrl("XAF"); // null: the CFA franc is several countries'
// Round: the square, clipped where it is drawn
// <img src="…/flags/UY.svg" alt="Uruguay" width="24" height="24" style="border-radius: 50%">Why
An app on the web, on iOS and on Android asks each the same questions: a country’s name in the user’s language and its flag, the currencies used there and how each is written, the market’s codes ISO lacks (CNH, GGP), the countries a bloc or a sanctions programme covers. Answered apart on each platform, the answers disagree: a country named one way in a browser and another on a phone, a name that changes when a system updates rather than when the app does.
Here it is one list. Each platform gets it in its own form (ES modules and SVG, JSON and an asset catalog, JSON and vector drawables) from one source at one version, and one file of answers is asked of the web, Swift and Kotlin alike: a platform that answers otherwise fails its own tests. So a flag, a name or a list of countries is the same on all three.
A flag an app rounds loses what makes it that flag when the circle falls on its middle: Uruguay’s sun is at the hoist, and so are the United States’ stars. Here each flag is a square cut where its mark is, in plain paths that a browser, iOS and Android draw alike: public domain drawings (or exempt from copyright) and, where one is out of date, the flag or the colours its law describes.
Without
- Dependencies, on any platform
- A server or an API key: the data is in the package
- A guessed flag for a currency of several countries
- Text or tables copied from a source: the data is facts, each checked
Cotizaciones UY is moving its flags to it.