Skip to content

Commit

Permalink
simplify usage without i18next
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed May 29, 2023
1 parent 14f64ea commit 6a39e00
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 7.0.2

- simplify usage without i18next

### 7.0.1

- try to force esm moduel type for esm build [269](https://github.com/i18next/i18next-browser-languageDetector/issues/269)
Expand Down
4 changes: 3 additions & 1 deletion i18nextBrowserLanguageDetector.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@
value: function init(services) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var i18nOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
this.services = services;
this.services = services || {
languageUtils: {}
}; // this way the language detector can be used without i18next
this.options = defaults(options, this.options || {}, getDefaults());

// backwards compatibility
Expand Down
2 changes: 1 addition & 1 deletion i18nextBrowserLanguageDetector.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"./package.json": "./package.json",
".": {
"types": "./index.d.ts",
"module": "./dist/esm/i18nextBrowserLanguageDetector.js",
"import": "./dist/esm/i18nextBrowserLanguageDetector.js",
"require": "./dist/cjs/i18nextBrowserLanguageDetector.js",
"default": "./dist/esm/i18nextBrowserLanguageDetector.js"
},
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Browser {
}

init(services, options = {}, i18nOptions = {}) {
this.services = services;
this.services = services || { languageUtils: {} }; // this way the language detector can be used without i18next
this.options = utils.defaults(options, this.options || {}, getDefaults());

// backwards compatibility
Expand Down

0 comments on commit 6a39e00

Please sign in to comment.