Lokalized JavaScript — Version 1.0.0
    Preparing search index...

    Function createLocaleMatcher

    • Create a locale matcher over a supported locale configuration.

      The matchFor* methods return a result with isMatch: false and locale: null when no supported locale matches. The bestMatchFor* methods return the configured fallback in that case.

      Parameters

      Returns Readonly<
          {
              bestMatchFor: (locale: string) => string;
              bestMatchForAcceptLanguage: (
                  acceptLanguage: string | null | undefined,
              ) => string;
              bestMatchForLanguageRanges: (
                  ranges: Iterable<Readonly<{ range: string; weight?: number }>>,
              ) => string;
              matchFor: (
                  locale: string,
              ) => Readonly<
                  {
                      consideredLocales: readonly string[];
                      effectiveWeight: number
                      | null;
                      fallbackLocale: string;
                      isMatch: boolean;
                      languageRange: string | WeightedLanguageRange | null;
                      locale: string | null;
                      matchType:
                          | "none"
                          | "exact"
                          | "canonical"
                          | "cldr-fallback"
                          | "likely-subtag"
                          | "extended-range"
                          | "primary-language"
                          | "wildcard";
                      requestedLanguageRanges: readonly WeightedLanguageRange[];
                  },
              >;
              matchForLanguageRanges: (
                  ranges: Iterable<Readonly<{ range: string; weight?: number }>>,
              ) => LocaleMatchResult;
          },
      >