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.3.1 to 0.4.0

dist/components/NextStaticProvider.js

10

dist/components/index.js

@@ -14,3 +14,11 @@ "use strict";

});
Object.defineProperty(exports, "NextStaticProvider", {
enumerable: true,
get: function get() {
return _NextStaticProvider.default;
}
});
var _Link = _interopRequireDefault(require("./Link"));
var _Link = _interopRequireDefault(require("./Link"));
var _NextStaticProvider = _interopRequireDefault(require("./NextStaticProvider"));

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

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

@@ -66,5 +68,11 @@

href = _this$props.href;
var lng = i18n.languages[0];
var lng = null;
if (localeSubpaths && lng !== defaultLanguage) {
if (Array.isArray(i18n.languages) && i18n.languages.length > 0) {
var _i18n$languages = (0, _slicedToArray2.default)(i18n.languages, 1);
lng = _i18n$languages[0];
}
if (localeSubpaths && lng && lng !== defaultLanguage) {
return _react.default.createElement(_link.default, {

@@ -71,0 +79,0 @@ href: "".concat(href, "?lng=").concat(lng),

39

dist/hocs/app-with-translation.js

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

var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

@@ -37,3 +35,4 @@

// import hoistNonReactStatic from 'hoist-non-react-statics'
var _components = require("../components");
function _default(WrappedComponent) {

@@ -78,4 +77,2 @@ var config = this.config,

value: function render() {
// ... and renders the wrapped component with the fresh data!
// Notice that we pass through any additional props
var _this$props = this.props,

@@ -94,3 +91,3 @@ initialLanguage = _this$props.initialLanguage,

initialI18nStore: initialI18nStore
}, _react.default.createElement(WrappedComponent, this.props));
}, _react.default.createElement(_components.NextStaticProvider, null, _react.default.createElement(WrappedComponent, this.props)));
}

@@ -110,3 +107,3 @@ }], [{

Component = _ref.Component, ctx = _ref.ctx;
// Recompile pre-existing pageProps
// Recompile pre-existing getInitialProps
pageProps = {};

@@ -126,8 +123,2 @@

case 6:
// if (WrappedComponent.getInitialProps) {
// pageProps = {
// ...pageProps,
// ...await WrappedComponent.getInitialProps(ctx),
// }
// }
// Initiate vars to return

@@ -155,7 +146,12 @@ req = ctx.req;

});
_context.next = 21;
_context.next = 22;
break;
case 17:
_context.next = 19;
if (!(Array.isArray(i18n.languages) && i18n.languages.length > 0)) {
_context.next = 22;
break;
}
_context.next = 20;
return Promise.all(i18n.nsFromReactTree.filter(function (ns) {

@@ -171,13 +167,14 @@ return !i18n.hasResourceBundle(i18n.languages[0], ns);

case 19:
case 20:
initialI18nStore = i18n.store.data;
initialLanguage = i18n.language;
case 21:
return _context.abrupt("return", (0, _objectSpread2.default)({
case 22:
return _context.abrupt("return", {
initialI18nStore: initialI18nStore,
initialLanguage: initialLanguage
}, pageProps));
initialLanguage: initialLanguage,
pageProps: pageProps
});
case 22:
case 23:
case "end":

@@ -184,0 +181,0 @@ return _context.stop();

{
"name": "next-i18next",
"version": "0.3.1",
"version": "0.4.0",
"main": "dist/index.js",

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

"detect-node": "^2.0.4",
"hoist-non-react-statics": "^3.1.0",
"i18next": "^12.0.0",

@@ -56,0 +55,0 @@ "i18next-browser-languagedetector": "^2.2.4",

@@ -136,4 +136,9 @@ # next-i18next

## Notes
- [`next export` will result in a _clientside only_ React application.](https://github.com/isaachinman/next-i18next/issues/10)
- [We cannot support koa until a 1:1 replacement for `i18next-express-middleware` exists](https://github.com/isaachinman/next-i18next/issues/9).
## Contributing
Please do! All PRs and issues will be thoroughly reviewed.

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