New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

i18next-xhr-backend

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-xhr-backend - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

12

package.json
{
"name": "i18next-xhr-backend",
"version": "0.3.0",
"version": "0.4.0",
"description": "backend layer for i18next using browsers xhr",
"main": "./bin/index.js",
"main": "./lib/index.js",
"keywords": [

@@ -18,7 +18,7 @@ "i18next",

"brfs": "1.4.2",
"browserify": "12.0.1",
"browserify": "12.0.2",
"browserify-istanbul": "0.2.1",
"chai": "2.3.0",
"coveralls": "2.11.6",
"eslint": "1.2.1",
"eslint": "1.10.3",
"gulp": "3.9.0",

@@ -37,3 +37,3 @@ "gulp-babel": "5.2.1",

"gulp-uglify": "1.5.1",
"i18next": "2.0.18",
"i18next": "2.1.0",
"istanbul": "gotwarlost/istanbul#source-map",

@@ -58,3 +58,3 @@ "json5": "0.4.0",

"vinyl-source-stream": "1.1.0",
"watchify": "3.6.1",
"watchify": "3.7.0",
"yargs": "3.31.0"

@@ -61,0 +61,0 @@ },

@@ -55,3 +55,3 @@ # Introduction

parse: function(data) { return data.replace(/a/g, ''); },
// allow cross domain requests

@@ -95,1 +95,32 @@ crossDomain: false,

```
### Usage with webpack
To use with webpack, install [bundle-loader](https://github.com/webpack/bundle-loader) and [json-loader](https://github.com/webpack/json-loader).
Define a custom xhr function, webpack's bundle loader will load the translations for you.
```js
function loadLocales(url, options, callback, data) {
try {
let waitForLocale = require('bundle!./locales/'+url+'.json');
waitForLocale((locale) => {
callback(locale, {status: '200'});
})
} catch (e) {
callback(null, {status: '404'});
}
}
i18next
.use(XHR)
.init({
backend: {
loadPath: '{{lng}}',
parse: (data) => data,
ajax: loadLocales
}
}, (err, t) => {
// ...
});
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc