INNER CODE UNIT · TypeScript

firstSupported

arc53/DocsGPT · extensions/react-widget/src/locale/index.ts:74

const firstSupported = (languages: readonly string[]) => {
  for (const language of languages) {
    const match = matchLocale(language);
    if (match) return match;
  }
  return null;
};

/**
 * The locale to show. `auto` (or nothing) takes the first of `languages`
 * the widget supports; an explicit code is matched the same way. Anything
 * unsupported is English.
 */
export const resolveLocale = (
  setting: string | undefined,
  languages: readonly string[] = browserLanguages(),
): SupportedLocale =>
  (isAuto(setting)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…