The user locale tested against
The locales translated by the app
Optional
options: PreferredLocaleOptions = {}Options for the function
The user's locale if it matches the app's locale, the app's locale if the languages match but region is or false if no matches
import { getAvailableLanguage } from 'preferred-locale'
getAvailableLanguage('en-US', ['en-US', 'en-GB']) // { isAvailable: true, appLocale: 'en-US' }
getAvailableLanguage('en-GB', ['en-US']) // { isAvailable: true, appLocale: 'en-US' }
getAvailableLanguage('es-ES', ['en-US']) // { isAvailable: false, appLocale: 'en-ES' }
Checks if the user's locale matches the same language with a different region translated by the app