Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rosetty-react

Package Overview
Dependencies
Maintainers
1
Versions
533
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rosetty-react - npm Package Compare versions

Comparing version 1.0.13 to 1.1.0

6

dist/index.d.ts
import React from 'react';
import { Language, RosettyReturn } from 'rosetty';
import { Locales } from 'rosetty/dist/types';
export declare const I18nContext: React.Context<{}>;
export declare const I18nHOC: ({ children, languages, defaultLanguage, }: {
export declare const RosettyContext: React.Context<{}>;
export declare const RosettyProvider: ({ children, languages, defaultLanguage, }: {
children: React.ReactNode;

@@ -10,3 +10,3 @@ languages: Record<string, Language>;

}) => JSX.Element;
export declare function useI18n<T>(): RosettyReturn<T>;
export declare function useRosetty<T>(): RosettyReturn<T>;
export declare const locales: Locales;

@@ -11,4 +11,4 @@ 'use strict';

var I18nContext = /*#__PURE__*/React.createContext({});
var I18nHOC = function I18nHOC(_ref) {
var RosettyContext = /*#__PURE__*/React.createContext({});
var RosettyProvider = function RosettyProvider(_ref) {
var children = _ref.children,

@@ -18,15 +18,15 @@ languages = _ref.languages,

var r = rosetty.rosetty(languages, defaultLanguage);
return React__default.createElement(I18nContext.Provider, {
return React__default.createElement(RosettyContext.Provider, {
value: r
}, children);
};
function useI18n() {
return React.useContext(I18nContext);
function useRosetty() {
return React.useContext(RosettyContext);
}
var locales = rosetty.locales;
exports.I18nContext = I18nContext;
exports.I18nHOC = I18nHOC;
exports.RosettyContext = RosettyContext;
exports.RosettyProvider = RosettyProvider;
exports.locales = locales;
exports.useI18n = useI18n;
exports.useRosetty = useRosetty;
//# sourceMappingURL=rosetty-react.cjs.development.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("rosetty"),n=t.createContext({}),u=o.locales;exports.I18nContext=n,exports.I18nHOC=function(e){var t=e.children,u=o.rosetty(e.languages,e.defaultLanguage);return r.createElement(n.Provider,{value:u},t)},exports.locales=u,exports.useI18n=function(){return t.useContext(n)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),r=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("rosetty"),s=t.createContext({}),u=o.locales;exports.RosettyContext=s,exports.RosettyProvider=function(e){var t=e.children,u=o.rosetty(e.languages,e.defaultLanguage);return r.createElement(s.Provider,{value:u},t)},exports.locales=u,exports.useRosetty=function(){return t.useContext(s)};
//# sourceMappingURL=rosetty-react.cjs.production.min.js.map
import React, { createContext, useContext } from 'react';
import { rosetty, locales as locales$1 } from 'rosetty';
var I18nContext = /*#__PURE__*/createContext({});
var I18nHOC = function I18nHOC(_ref) {
var RosettyContext = /*#__PURE__*/createContext({});
var RosettyProvider = function RosettyProvider(_ref) {
var children = _ref.children,

@@ -10,12 +10,12 @@ languages = _ref.languages,

var r = rosetty(languages, defaultLanguage);
return React.createElement(I18nContext.Provider, {
return React.createElement(RosettyContext.Provider, {
value: r
}, children);
};
function useI18n() {
return useContext(I18nContext);
function useRosetty() {
return useContext(RosettyContext);
}
var locales = locales$1;
export { I18nContext, I18nHOC, locales, useI18n };
export { RosettyContext, RosettyProvider, locales, useRosetty };
//# sourceMappingURL=rosetty-react.esm.js.map
{
"version": "1.0.13",
"version": "1.1.0",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -12,3 +12,3 @@ [![Maintainability](https://api.codeclimate.com/v1/badges/82e2c932c7dde770cdd4/maintainability)](https://codeclimate.com/github/flexper/rosetty-react/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/82e2c932c7dde770cdd4/test_coverage)](https://codeclimate.com/github/flexper/rosetty-react/test_coverage) ![npm](https://img.shields.io/npm/v/rosetty-react) ![npm](https://img.shields.io/npm/dm/rosetty-react) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/rosetty-react) ![NPM](https://img.shields.io/npm/l/rosetty-react)

import { I18nHOC, locales as rosettyLocales } from 'rosetty-react';
import { RosettyProvider, locales as rosettyLocales } from 'rosetty-react';

@@ -19,5 +19,5 @@ const locales = { fr: { dict: {}, locale: rosettyLocales.fr } };

const App = ({ children }) => (
<I18nHOC locales={locales} defaultLanguage={defaultLanguage}>
<RosettyProvider locales={locales} defaultLanguage={defaultLanguage}>
{children}
</I18nHOC>
</RosettyProvider>
);

@@ -29,6 +29,6 @@

import { useI18n } from 'rosetty-react';
import { useRosetty } from 'rosetty-react';
const Home = () => {
const { t } = useI18n();
const { t } = useRosetty();
return <h1>{t('home')}</h1>;

@@ -43,3 +43,3 @@ };

### I18nHOC
### RosettyProvider

@@ -46,0 +46,0 @@ **Options**

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