findLocale
Converts a 2-letter language code into a full language-region locale string (e.g., “en” to “en-US”).
Basic example
Section titled “Basic example”Expands a two-letter language code to the full language-region tag the dictionaries are keyed by, preferring a well-known default (en → en-US, pt → pt-BR) and otherwise the region that matches the language (de → de-DE). A full five-character tag or an unknown code is returned unchanged.
import {findLocale} from "@d3plus/locales";
findLocale("en");
findLocale("pt");
findLocale("es");
findLocale("de");
findLocale("fr");
findLocale("zh");
findLocale("xx");
findLocale("en-GB");
Parameters
import {findLocale} from "@d3plus/locales";
localerequiredstringA 2-letter language code (e.g., "en", "fr").