Skip to content

Commit

Permalink
use fallbackLng as default lng
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Dec 11, 2020
1 parent ba564b3 commit ad88092
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/i18next.js
Expand Up @@ -120,6 +120,10 @@ class I18n extends EventEmitter {
});
}

if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng)
if (codes.length > 0 && codes[0] !== 'dev') this.options.lng = codes[0]
}
if (!this.services.languageDetector && !this.options.lng) {
this.logger.warn('init: no languageDetector is used and no lng is defined');
}
Expand Down

0 comments on commit ad88092

Please sign in to comment.