Skip to content

Commit

Permalink
Documentation: include supportedLngs in example (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgmstuart committed Apr 21, 2024
1 parent 80754d8 commit 026a335
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ Wiring up:
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';

i18next.use(LanguageDetector).init(i18nextOptions);
i18next.use(LanguageDetector).init({
supportedLngs: ['de', 'en', 'fr'],
...i18nextOptions
});
```

As with all modules you can either pass the constructor function (class) to the i18next.use or a concrete instance.

[`supportedLngs`](https://www.i18next.com/overview/configuration-options#languages-namespaces-resources) is optional, but allows i18next to pick the best match from the list of detected languages. If it's not set then [`language`](https://www.i18next.com/overview/api#language) will be set to the first detected language, regardless of whether your application has translations for that language or not.

## Detector Options
*The default options can be found [here](https://github.com/i18next/i18next-browser-languageDetector/blob/9efebe6ca0271c3797bc09b84babf1ba2d9b4dbb/src/index.js#L11).*

Expand Down

0 comments on commit 026a335

Please sign in to comment.