UNPKG

@nacelle/compatibility-connector

Version:

Connect @nacelle/client-js-sdk to Nacelle's v2 back end with minimal code changes

17 lines (13 loc) 389 B
/** * @param inputLocale A dash-delimited language-region pair * @returns an IETF language tag */ export function toIetfLocale( inputLocale?: string, defaultLocale = 'en-US' ): string { if (!inputLocale) return defaultLocale; const [lang, region] = inputLocale.split('-'); if (!region) return lang.toLowerCase(); return lang.toLowerCase() + '-' + region.toUpperCase(); }