Skip to content

Commit

Permalink
Merge pull request #190 from Shepard/master
Browse files Browse the repository at this point in the history
Added option to prevent checking whitelist for detected languages
  • Loading branch information
jamuhl committed Oct 4, 2019
2 parents 260dab6 + a64f49f commit 5c367f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ As with all modules you can either pass the constructor function (class) to the
cookieDomain: 'myDomain',

// optional htmlTag with lang attribute, the default is:
htmlTag: document.documentElement
htmlTag: document.documentElement,

// only detect languages that are in the whitelist
checkWhitelist: true
}
```

Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Browser {
detected.forEach(lng => {
if (found) return;
let cleanedLng = this.services.languageUtils.formatLanguageCode(lng);
if (this.services.languageUtils.isWhitelisted(cleanedLng)) found = cleanedLng;
if (!this.options.checkWhitelist || this.services.languageUtils.isWhitelisted(cleanedLng)) found = cleanedLng;
});

if (!found) {
Expand Down

0 comments on commit 5c367f7

Please sign in to comment.