getBestMatch method

MatchResult getBestMatch(
  1. Iterable<LanguageId> desiredLocales, {
  2. bool favorScript = false,
  3. bool favorEarlier = true,
  4. bool ignoreFallback = false,
})

Get the best match from the desiredLocales out of the supportedLocales.

If favorScript is set to true then script difference will become more important, by dividing language differences by 4.

If favorEarlier is set to true (default) locales earlier in supportedLocales are prioritized. If set to false, the order of the supportedLocales does not matter.

If ignoreFallback is set then only bidirectional matches will be used. So fallbacks to languages that many of the desiredLocales speakers understand, but are not related to the original locale, will not be included.

Implementation

MatchResult getBestMatch(
  Iterable<LanguageId> desiredLocales, {
  bool favorScript = false,
  bool favorEarlier = true,
  bool ignoreFallback = false,
}) =>
    _getBestMatch(
      desiredLocales,
      favorScript: favorScript,
      favorEarlier: favorEarlier,
      ignoreFallback: ignoreFallback,
    );