LanguageUtils.js (i18next-22.4.11) | : | LanguageUtils.js (i18next-22.4.12) | ||
---|---|---|---|---|
skipping to change at line 96 | skipping to change at line 96 | |||
if (!found && this.options.supportedLngs) { | if (!found && this.options.supportedLngs) { | |||
codes.forEach((code) => { | codes.forEach((code) => { | |||
if (found) return; | if (found) return; | |||
const lngOnly = this.getLanguagePartFromCode(code); | const lngOnly = this.getLanguagePartFromCode(code); | |||
// eslint-disable-next-line no-return-assign | // eslint-disable-next-line no-return-assign | |||
if (this.isSupportedCode(lngOnly)) return (found = lngOnly); | if (this.isSupportedCode(lngOnly)) return (found = lngOnly); | |||
// eslint-disable-next-line array-callback-return | // eslint-disable-next-line array-callback-return | |||
found = this.options.supportedLngs.find((supportedLng) => { | found = this.options.supportedLngs.find((supportedLng) => { | |||
if (supportedLng === lngOnly) return supportedLng; | ||||
if (supportedLng.indexOf('-') < 0 && lngOnly.indexOf('-') < 0) return; | ||||
if (supportedLng.indexOf(lngOnly) === 0) return supportedLng; | if (supportedLng.indexOf(lngOnly) === 0) return supportedLng; | |||
}); | }); | |||
}); | }); | |||
} | } | |||
// if nothing found, use fallbackLng | // if nothing found, use fallbackLng | |||
if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0]; | if (!found) found = this.getFallbackCodes(this.options.fallbackLng)[0]; | |||
return found; | return found; | |||
} | } | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added |