function toAzureLocale()

in packages/embed/src/locale.js [71:111]


function toAzureLocale(language) {
  switch (language) {
    case 'fr':
      // This is for Firefox, which default French to "fr" instead of "fr-FR".
      return 'fr.fr-fr';

    case 'pt-BR':
      return 'pt-br.pt-br';

    case 'pt-PT':
      return 'pt-pt.pt-pt';

    case 'yue':
    case 'zh-Hant-HK':
      return 'zh-hant.zh-hk';

    case 'zh-Hans':
      return 'zh-hans.zh-cn';

    case 'zh-Hans-SG':
      return `zh-hans.zh-sg`;

    case 'zh-Hant':
      return 'zh-hant.zh-tw';

    case 'zh-Hant-MO':
      return 'zh-hant.zh-mo';
  }

  if (
    Object.keys(AZURE_LOCALE_MAPPING).some(azureLocaleFirstPart =>
      language.toLowerCase().startsWith(azureLocaleFirstPart)
    )
  ) {
    const match = JAVASCRIPT_LOCALE_PATTERN.exec(language);

    if (match) {
      return `${match[1]}.${match[1]}-${match[3].toLowerCase()}`;
    }
  }
}