Socket
Socket
Sign inDemoInstall

next-i18next

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-i18next - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

middleware.js

4

dist/components/Link.js

@@ -100,2 +100,4 @@ "use strict";

return this.withNamespaces()(Link);
}
}
module.exports = exports.default;

@@ -55,2 +55,3 @@ "use strict";

exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -21,3 +21,3 @@ "use strict";

if (_detectNode.default && !process.browser) {
var fs = eval("require('fs')"); // eslint-disable-line
var fs = eval("require('fs')");

@@ -50,2 +50,3 @@ var path = require('path');

exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -31,2 +31,3 @@ "use strict";

},
browserLanguageDetection: true,
detection: {

@@ -44,2 +45,3 @@ order: ['cookie', 'header', 'querystring'],

};
exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -21,14 +21,16 @@ "use strict";

if (_detectNode.default) {
var i18nextNodeBackend = eval("require('i18next-node-fs-backend')"); // eslint-disable-line
var _default = function _default(config) {
if (!i18n.isInitialized) {
if (_detectNode.default) {
var i18nextNodeBackend = eval("require('i18next-node-fs-backend')");
var i18nextMiddleware = eval("require('i18next-express-middleware')");
i18n.use(i18nextNodeBackend).use(i18nextMiddleware.LanguageDetector);
} else {
i18n.use(_i18nextXhrBackend.default);
var i18nextMiddleware = require('i18next-express-middleware');
if (config.browserLanguageDetection) {
i18n.use(_i18nextBrowserLanguagedetector.default);
}
}
i18n.use(i18nextNodeBackend).use(i18nextMiddleware.LanguageDetector);
} else {
i18n.use(_i18nextXhrBackend.default).use(_i18nextBrowserLanguagedetector.default);
}
var _default = function _default(config) {
if (!i18n.isInitialized) {
config.use.forEach(function (x) {

@@ -43,2 +45,3 @@ return i18n.use(x);

exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -216,2 +216,4 @@ "use strict";

});
}
}
module.exports = exports.default;

@@ -19,2 +19,4 @@ "use strict";

return (0, _reactI18next.withNamespaces)(namespaces, options);
}
}
module.exports = exports.default;

@@ -20,4 +20,2 @@ "use strict";

var _middlewares = require("./middlewares");
var NextI18Next = function NextI18Next(userConfig) {

@@ -28,3 +26,2 @@ (0, _classCallCheck2.default)(this, NextI18Next);

this.appWithTranslation = _hocs.appWithTranslation.bind(this);
this.nextI18NextMiddleware = _middlewares.nextI18NextMiddleware.bind(this);
this.withNamespaces = _hocs.withNamespaces.bind(this);

@@ -34,2 +31,3 @@ this.Link = _components.Link.apply(this);

exports.default = NextI18Next;
exports.default = NextI18Next;
module.exports = exports.default;

@@ -14,5 +14,5 @@ "use strict";

function _default(app, server) {
var config = this.config,
i18n = this.i18n;
function _default(nexti18next, app, server) {
var config = nexti18next.config,
i18n = nexti18next.i18n;
var allLanguages = config.allLanguages,

@@ -32,2 +32,4 @@ localeSubpaths = config.localeSubpaths;

}
}
}
module.exports = exports.default;

@@ -23,2 +23,3 @@ "use strict";

exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -57,2 +57,3 @@ "use strict";

exports.default = _default;
exports.default = _default;
module.exports = exports.default;

@@ -49,2 +49,3 @@ "use strict";

exports.default = _default;
exports.default = _default;
module.exports = exports.default;
{
"name": "next-i18next",
"version": "0.8.0",
"version": "0.9.0",
"main": "dist/index.js",

@@ -28,3 +28,4 @@ "repository": "git@github.com:isaachinman/next-i18next.git",

"prepare": "yarn build",
"run-example": "yarn build && cd example && yarn && yarn dev"
"run-example": "yarn build && cd example && rm -rf node_modules && yarn && yarn dev",
"run-example:prod": "yarn build && cd example && rm -rf node_modules && yarn && yarn build && yarn start"
},

@@ -43,2 +44,3 @@ "husky": {

"@babel/preset-react": "^7.0.0",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-module-resolver": "^3.1.1",

@@ -45,0 +47,0 @@ "babel-plugin-transform-async-to-generator": "^6.24.1",

@@ -58,3 +58,3 @@ # next-i18next

1. Create an `_app.js` file inside your `pages` directory, and wrap it with the `NextI18Next.appWithTranslation` higher order component (HOC). You can see this approach in the [example/pages/_app.js](./example/pages/_app.js).
2. Create a `server.js` file inside your root directory, initialise an [express](https://www.npmjs.com/package/express) server, and pass both the express server and NextJs app into `NextI18Next.nextI18NextMiddleware`. You can see this approach in the [example/server.js](./example/server.js)
2. Create a `server.js` file inside your root directory, initialise an [express](https://www.npmjs.com/package/express) server, and pass (a) your NextI18Next instance, (b) express server and (c) NextJs app into `NextI18Next.nextI18NextMiddleware`. You can see this approach in the [example/server.js](./example/server.js). For more info, see [the NextJs section on custom servers](https://github.com/zeit/next.js#custom-server-and-routing).

@@ -135,3 +135,5 @@ That's it! Your app is ready to go. You can now use the `NextI18Next.withNamespaces` HOC to make your components or pages translatable, based on namespaces:

| ------------- | ------------- |
| `defaultLanguage` | `"en"` |
| `browserLanguageDetection` | `true` |
| `defaultNS` | `'common'` |
| `defaultLanguage` | `'en'` |
| `otherLanguages` | `[]` |

@@ -141,5 +143,6 @@ | `localePath` | `'static/locales'` |

| `localeSubpaths` | `false` |
| `defaultNS` | `'common'` |
| `use` (for plugins) | `[]` |
_This table contains options which are specific to next-i18next. All other [i18next options](https://www.i18next.com/overview/configuration-options) can be passed in as well._
## Notes

@@ -146,0 +149,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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