Locale metadata¶
Translate language, country, script, calendar, and currency codes into their localised display names — and a couple of handy extras (text direction, flag emoji). Every method falls back to the instance locale's own subtags when called without an argument.
Language, country, script, calendar¶
Called with no argument, each uses the instance locale: new Cosmo('en_AU')'s
country() returns "Australia", language() returns "English".
Direction & flag¶
flag() is pure Unicode codepoint math (region letters → regional-indicator
symbols), so no data table is involved. direction() resolves likely subtags
first, so even script-only or minority RTL languages are detected correctly.
Currency name & symbol¶
The symbol form returns the standard, disambiguated symbol ("A$" for AUD in
en_US), not the ambiguous narrow "$".
Likely subtags
Maximising/minimising a locale (en ↔ en-Latn-US) is available in
JavaScript, Python, and Java (addLikelySubtags() / removeLikelySubtags()
— add_likely_subtags() / remove_likely_subtags() in Python). PHP's intl
extension does not expose the likely-subtags algorithm, so it is the one port
without these. See Platform notes.