{"_id":"@byhuz/i18next-browser-languagedetector","_rev":"19-4ed88a24496ead1a515cb784a46878e2","name":"@byhuz/i18next-browser-languagedetector","dist-tags":{"latest":"4.2.2"},"versions":{"4.2.0":{"name":"@byhuz/i18next-browser-languagedetector","version":"4.2.0","description":"language detector used in browser environment for i18next","main":"./dist/cjs/i18nextBrowserLanguageDetector.js","module":"./dist/esm/i18nextBrowserLanguageDetector.js","types":"./index.d.ts","keywords":["i18next","i18next-languageDetector"],"homepage":"https://github.com/i18next/i18next-browser-languageDetector","bugs":{"url":"https://github.com/i18next/i18next-browser-languageDetector/issues"},"repository":{"type":"git","url":"git+https://github.com/i18next/i18next-browser-languageDetector.git"},"dependencies":{"@babel/runtime":"^7.5.5"},"devDependencies":{"@babel/core":"^7.5.5","@babel/plugin-transform-runtime":"^7.5.5","@babel/preset-env":"^7.5.5","babel-eslint":"^10.0.2","babel-polyfill":"^6.26.0","babelify":"^10.0.0","browserify":"16.3.0","browserify-istanbul":"3.0.1","chai":"4.2.0","coveralls":"3.0.5","cpy-cli":"^2.0.0","dtslint":"^0.9.1","eslint":"6.1.0","eslint-config-airbnb":"17.1.1","expect.js":"0.3.1","i18next":"^19.0.0","mkdirp":"0.5.1","mocha":"7.1.2","rimraf":"2.6.3","rollup":"^1.18.0","rollup-plugin-babel":"^4.3.3","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-terser":"^5.1.1","tslint":"^5.18.0","typescript":"^3.5.3","yargs":"13.3.0"},"scripts":{"pretest":"npm run test:typescript && npm run test:typescript:noninterop","test":"npm run build && mocha test -R spec --exit","test:typescript":"tslint --project tsconfig.json","test:typescript:noninterop":"tslint --project tsconfig.nonEsModuleInterop.json","build":"rimraf dist && rollup -c && cpy \"./dist/umd/*.js\" ./","preversion":"npm run build && git push","postversion":"git push && git push --tags","deploy":"npm install && npm run build && npm publish --access public"},"author":{"name":"Jan Mühlemann","email":"jan.muehlemann@gmail.com","url":"https://github.com/jamuhl"},"license":"MIT","gitHead":"3a9be30e2653bc2b3350d5af92080a0ef727a5ce","_id":"@byhuz/i18next-browser-languagedetector@4.2.0","_nodeVersion":"12.16.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-qErWCP6sB7l+wfN4x8e+q5a5PgpC+gkJkMrzPMtpHiWjXs4+YrnSSvj11GfidC6WAIFVMuZGZhIEsmwxOgueIw==","shasum":"da37b0feb318eb1c4a6480752cbad49c049a939a","tarball":"https://registry.npmjs.org/@byhuz/i18next-browser-languagedetector/-/i18next-browser-languagedetector-4.2.0.tgz","fileCount":8,"unpackedSize":50154,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4Bi4CRA9TVsSAnZWagAAOG8P/2BbJoT/O6muXfSKdZ+K\nzIavN2x1KWCN5RfleWJwaXgPRM3q/AuCfFCxvJznsqLlGiBb52pLvCMp00b0\nOFaMMTn+o8+nyD5Os3foKuBzQZ8rQpAPHpJp7NiFy4r/GWeVDL3TtExMK1IT\nFAbTd0FPN3S0FRfFGWjXOlQoKegiBlM4STKPRu0MsPvsYsR9dSXB0njp+a5O\nEhNK1RY1KsPwuo7aokD90Yg1yZcs7EdC8wpyDG4SdMkAyTh7mhU/eVLdFVVF\nGM/O+pEjQsDwtkGFyFNh7/Xd/vUpoZSyPox/esNdCd7kyjXOFwY+8d/OT2R2\n9P/L5hLZniHeB6qQCWG9YLfDAvdZbtgjrcTkh792+YwQwojqFPTeHwcMK5V6\ny9KoLbi2XN55PFxVU2J/ab/wvb0wm7AnQO4z+MPZg4fN9+R2NoJ9a12NPukf\nOwqPPKd17s/yu149vd6bIEIgJz4g9UWxc0JfXHYsoSMKzhTFt/m/YFBFbLVb\nfOtbYAy5I8is85zkjtdns04QRpLMFMww2V7gR3mleJlqjvhxgVXFlsVQp7e8\nbNG24uRNyvSoGnj4lTo5/DOnZolmwH7wEAnZx8QqPyPm0H8FFUTXRNVDSKCo\n7EtP3legpaSMAJpG8mQZWAbmaG+6Tkc9D2i3EwWDJn0piPcLwjkJAEHfuTM6\nRmXT\r\n=TQ3F\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHmDK5zJfiDw0mBDObVnTUbwZEv9UH18wNuoNiAWj20FAiEAurHUcdAXZo/tCO6oYxcJVPShZWZER93raKUwGPnO+b4="}]},"maintainers":[{"name":"serdark","email":"s.kizilkurt@azerion.com"},{"name":"savasyilmaz","email":"savas.yilmaz@triodor.eu"},{"name":"furkankursun","email":"f.kursun@azerion.com"},{"name":"e.buyuk","email":"e.boyuk@azerion.com"},{"name":"gboyraz","email":"gultekinboyraz@gmail.com"}],"_npmUser":{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/i18next-browser-languagedetector_4.2.0_1591744695803_0.664145465051357"},"_hasShrinkwrap":false},"4.2.2":{"name":"@byhuz/i18next-browser-languagedetector","version":"4.2.2","description":"language detector used in browser environment for i18next","main":"./dist/cjs/i18nextBrowserLanguageDetector.js","module":"./dist/esm/i18nextBrowserLanguageDetector.js","types":"./index.d.ts","keywords":["i18next","i18next-languageDetector"],"homepage":"https://github.com/i18next/i18next-browser-languageDetector","bugs":{"url":"https://github.com/i18next/i18next-browser-languageDetector/issues"},"repository":{"type":"git","url":"git+https://github.com/i18next/i18next-browser-languageDetector.git"},"dependencies":{"@babel/runtime":"^7.5.5"},"devDependencies":{"@babel/core":"^7.5.5","@babel/plugin-transform-runtime":"^7.5.5","@babel/preset-env":"^7.5.5","babel-eslint":"^10.0.2","babel-polyfill":"^6.26.0","babelify":"^10.0.0","browserify":"16.3.0","browserify-istanbul":"3.0.1","chai":"4.2.0","coveralls":"3.0.5","cpy-cli":"^2.0.0","dtslint":"^0.9.1","eslint":"6.1.0","eslint-config-airbnb":"17.1.1","expect.js":"0.3.1","i18next":"^19.0.0","mkdirp":"0.5.1","mocha":"7.1.2","rimraf":"2.6.3","rollup":"^1.18.0","rollup-plugin-babel":"^4.3.3","rollup-plugin-node-resolve":"^5.2.0","rollup-plugin-terser":"^5.1.1","tslint":"^5.18.0","typescript":"^3.5.3","yargs":"13.3.0"},"scripts":{"pretest":"npm run test:typescript && npm run test:typescript:noninterop","test":"npm run build && mocha test -R spec --exit","test:typescript":"tslint --project tsconfig.json","test:typescript:noninterop":"tslint --project tsconfig.nonEsModuleInterop.json","build":"rimraf dist && rollup -c && cpy \"./dist/umd/*.js\" ./","preversion":"npm run build && git push","postversion":"git push && git push --tags","deploy":"npm install && npm run build && npm publish --access public"},"author":{"name":"Jan Mühlemann","email":"jan.muehlemann@gmail.com","url":"https://github.com/jamuhl"},"license":"MIT","gitHead":"3a9be30e2653bc2b3350d5af92080a0ef727a5ce","_id":"@byhuz/i18next-browser-languagedetector@4.2.2","_nodeVersion":"12.16.1","_npmVersion":"6.14.4","dist":{"integrity":"sha512-qLD+TNS1StEULSDnw0QdkieTz1TTlOXajeh3Ox+EefCzMlATx5dyht/X+wJN8viwfUuuCH8FGqWvGWFUyvJO6Q==","shasum":"36a2f93ff4e76fe20defec43bc1e6e0deb177733","tarball":"https://registry.npmjs.org/@byhuz/i18next-browser-languagedetector/-/i18next-browser-languagedetector-4.2.2.tgz","fileCount":8,"unpackedSize":51802,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2CFWCRA9TVsSAnZWagAAkIkP/R6LmHiWTHJxQq56lpoo\nZGz9kMZjcNVthaGxl+Z+VoLHnGzmtpCot8S9SJlrbLrFytAB0OzbE8ZBIxpk\n1BmBX1CUkBlYBcrFXqtqvXyw95qv7hGFahyzTXHKRLdC/1vWSx7WoregDPgV\nyOUJSehjhwehHg2cL2DiGI7XWsBz+4PioZPWKmyiMYYEgpCMS4Mr6BgsSTYD\ni3ZrEMFDsl6PdW7r/loq0aLduOR131W2CuSumU4YOwTGjQmuWOhxj9tllKpX\nWCZSd2vZ4cM80j3qDOwtY0fH75dtreq9hYSCsT4OQlfKL2B78G+fJL7XPKpg\nz2lSidnlpwelYvVPIED9ugryNz5q22gcNSV7/azldEfHrNQmOFBn/jPzm6kq\nMuB0xgQxmzFMCduYj7NURE1dd141Ifd7YtmiALUZaiqWF7grV60mbb7M3xrA\nVxoc98UYWP6409Zke0kTh8A5OXDBNDj3mnhJa23+jEmeyqc6KIY0l934rUBz\n6KogAq7M5Ui8un/Q4FGrGUaUws5gT9f3M4kzXJvZl26Leb8VD9g60P43tJxU\n070jFtQnrZDqjU+4p53fylWKpdrrm+DLeMJV/xBhyaS+zLrJ/bHe9G0JrXBY\n1rjFQISEjaIHPvXMAkCRG+Vw+vB7pMSz2ia5kkW5XN/L+pjLx5UK1f2yr9ab\ndjEY\r\n=Un/P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCZJoilVOGZOYf9fm3rqdkJA+2sM/yGqaV+zug9eKwzgwIhAODx+BmiU9wcOutWrtLS6plE5BqnvzCxvLcCdp2vLwSr"}]},"maintainers":[{"name":"e.buyuk","email":"e.boyuk@azerion.com"},{"name":"furkankursun","email":"f.kursun@azerion.com"},{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},{"name":"savasyilmaz","email":"savas.yilmaz@triodor.eu"},{"name":"serdark","email":"s.kizilkurt@azerion.com"}],"_npmUser":{"name":"gboyraz","email":"gultekinboyraz@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/i18next-browser-languagedetector_4.2.2_1591744908331_0.43580435465569467"},"_hasShrinkwrap":false}},"time":{"created":"2020-06-09T23:18:15.555Z","4.2.0":"2020-06-09T23:18:15.921Z","modified":"2023-06-06T12:57:23.417Z","4.2.2":"2020-06-09T23:21:48.483Z"},"maintainers":[{"email":"yagiz.aydin@azerion.com","name":"yagizaydin"},{"email":"demiremrece@gmail.com","name":"demiremrece"},{"email":"a.hulsman@azerion.com","name":"hulsman1986"},{"email":"gultekinboyraz@gmail.com","name":"gboyraz"}],"description":"language detector used in browser environment for i18next","homepage":"https://github.com/i18next/i18next-browser-languageDetector","keywords":["i18next","i18next-languageDetector"],"repository":{"type":"git","url":"git+https://github.com/i18next/i18next-browser-languageDetector.git"},"author":{"name":"Jan Mühlemann","email":"jan.muehlemann@gmail.com","url":"https://github.com/jamuhl"},"bugs":{"url":"https://github.com/i18next/i18next-browser-languageDetector/issues"},"license":"MIT","readme":"# Introduction\n\n[![npm version](https://img.shields.io/npm/v/i18next-browser-languagedetector.svg?style=flat-square)](https://www.npmjs.com/package/i18next-browser-languagedetector)\n[![Bower](https://img.shields.io/bower/v/i18next-browser-languagedetector.svg)]()\n[![David](https://img.shields.io/david/i18next/i18next-browser-languagedetector.svg?style=flat-square)](https://david-dm.org/i18next/i18next-browser-languagedetector)\n\nThis is a i18next language detection plugin use to detect user language in the browser with support for:\n\n- cookie (set cookie i18next=LANGUAGE)\n- localStorage (set key i18nextLng=LANGUAGE)\n- navigator (set browser language)\n- querystring (append `?lng=LANGUAGE` to URL)\n- htmlTag (add html language tag <html lang=\"LANGUAGE\" ...)\n- path (http://my.site.com/LANGUAGE/...)\n- subdomain (http://LANGUAGE.site.com/...)\n\n# Getting started\n\nSource can be loaded via [npm](https://www.npmjs.com/package/i18next-browser-languagedetector), bower or [downloaded](https://github.com/i18next/i18next-browser-languagedetector/blob/master/i18nextBrowserLanguageDetector.min.js) from this repo.\n\n```\n# npm package\n$ npm install i18next-browser-languagedetector\n\n# bower\n$ bower install i18next-browser-languagedetector\n```\n\n- If you don't use a module loader it will be added to `window.i18nextBrowserLanguageDetector`\n\nWiring up:\n\n```js\nimport i18next from 'i18next';\nimport LanguageDetector from 'i18next-browser-languagedetector';\n\ni18next\n  .use(LanguageDetector)\n  .init(i18nextOptions);\n```\n\nAs with all modules you can either pass the constructor function (class) to the i18next.use or a concrete instance.\n\n## Detector Options\n\n```js\n{\n  // order and from where user language should be detected\n  order: ['querystring', 'cookie', 'localStorage', 'navigator', 'htmlTag', 'path', 'subdomain'],\n\n  // keys or params to lookup language from\n  lookupQuerystring: 'lng',\n  lookupCookie: 'i18next',\n  lookupLocalStorage: 'i18nextLng',\n  lookupFromPathIndex: 0,\n  lookupFromSubdomainIndex: 0,\n\n  // cache user language on\n  caches: ['localStorage', 'cookie'],\n  excludeCacheFor: ['cimode'], // languages to not persist (cookie, localStorage)\n\n  // optional expire and domain for set cookie\n  cookieMinutes: 10,\n  cookieDomain: 'myDomain',\n\n  // optional htmlTag with lang attribute, the default is:\n  htmlTag: document.documentElement,\n\n  // only detect languages that are in the whitelist\n  checkWhitelist: true,\n\n  // fallback to a similar whitelist language\n  // Example 1: Browser language is 'es'\n  // if 'es' is not found in whitelist, first fallback to any whitelist language that starts with 'es-', then fallback to fallbackLng ('es' -> 'es-*' -> fallbackLng)\n  // Example 2: Browser language is 'es-MX'\n  // if 'es-MX' is not found in whitelist, first fallback to 'es', then fallback to 'es-*', then fallback to fallbackLng ('es-MX' -> 'es' -> 'es-*' -> fallbackLng)\n  checkForSimilarInWhitelist: false,\n\n  // optional set cookie options, reference:[MDN Set-Cookie docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)\n  cookieOptions: {path:'/'}\n}\n```\n\nOptions can be passed in:\n\n**preferred** - by setting options.detection in i18next.init:\n\n```js\nimport i18next from 'i18next';\nimport LanguageDetector from 'i18next-browser-languagedetector';\n\ni18next\n  .use(LanguageDetector)\n  .init({\n    detection: options\n  });\n```\n\non construction:\n\n```js\n  import LanguageDetector from 'i18next-browser-languagedetector';\n  const languageDetector = new LanguageDetector(null, options);\n```\n\nvia calling init:\n\n```js\n  import LanguageDetector from 'i18next-browser-languagedetector';\n  const languageDetector = new LanguageDetector();\n  lngDetector.init(options);\n```\n\n## Adding own detection functionality\n\n### interface\n\n```js\nexport default {\n  name: 'myDetectorsName',\n\n  lookup(options) {\n    // options -> are passed in options\n    return 'en';\n  },\n\n  cacheUserLanguage(lng, options) {\n    // options -> are passed in options\n    // lng -> current language, will be called after init and on changeLanguage\n\n    // store it\n  }\n};\n```\n\n\n### adding it\n\n```js\n  import LanguageDetector from 'i18next-browser-languagedetector';\n  const languageDetector = new LanguageDetector();\n  languageDetector.addDetector(myDetector);\n\n  i18next\n    .use(languageDetector)\n    .init({\n      detection: options\n    });\n```\n\nDon't forget: You have to add the name of your detector (`myDetectorsName` in this case) to the `order` array in your `options` object. Without that, your detector won't be used. See the [Detector Options section for more](#detector-options).\n\n--------------\n\n<h3 align=\"center\">Gold Sponsors</h3>\n\n<p align=\"center\">\n  <a href=\"https://locize.com/\" target=\"_blank\">\n    <img src=\"https://raw.githubusercontent.com/i18next/i18next/master/assets/locize_sponsor_240.gif\" width=\"240px\">\n  </a>\n</p>\n","readmeFilename":"README.md"}