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

@m6web/react-i18n

Package Overview
Dependencies
Maintainers
7
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@m6web/react-i18n - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

# [3.0.0](https://github.com/BedrockStreaming/i18n-tools/compare/@m6web/react-i18n@2.0.1...@m6web/react-i18n@3.0.0) (2022-01-20)
**Note:** Version bump only for package @m6web/react-i18n
## [2.0.1](https://github.com/BedrockStreaming/i18n-tools/compare/@m6web/react-i18n@2.0.0...@m6web/react-i18n@2.0.1) (2022-01-10)

@@ -8,0 +16,0 @@

12

es/hooks/useTranslate.js

@@ -5,13 +5,3 @@ import { useContext } from 'react';

export var useTranslate = function useTranslate() {
var t = useContext(Context);
return function (key) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
data = _ref.data,
number = _ref.number,
general = _ref.general,
renderers = _ref.renderers;
return t(key, data, number, general, renderers);
};
return useContext(Context);
};

@@ -59,6 +59,8 @@ import _has from 'lodash-es/has';

return function (key) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var number = arguments[2];
var general = arguments[3];
var renderers = arguments[4];
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$data = _ref.data,
data = _ref$data === undefined ? {} : _ref$data,
number = _ref.number,
general = _ref.general,
renderers = _ref.renderers;

@@ -65,0 +67,0 @@ var combineKey = key;

@@ -13,13 +13,3 @@ 'use strict';

var useTranslate = exports.useTranslate = function useTranslate() {
var t = (0, _react.useContext)(_i18n.Context);
return function (key) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
data = _ref.data,
number = _ref.number,
general = _ref.general,
renderers = _ref.renderers;
return t(key, data, number, general, renderers);
};
return (0, _react.useContext)(_i18n.Context);
};

@@ -69,6 +69,8 @@ 'use strict';

return function (key) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var number = arguments[2];
var general = arguments[3];
var renderers = arguments[4];
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$data = _ref.data,
data = _ref$data === undefined ? {} : _ref$data,
number = _ref.number,
general = _ref.general,
renderers = _ref.renderers;

@@ -75,0 +77,0 @@ var combineKey = key;

{
"name": "@m6web/react-i18n",
"version": "2.0.1",
"version": "3.0.0",
"description": "Provider and utils for translation in a react app",

@@ -57,3 +57,3 @@ "main": "lib/index.js",

},
"gitHead": "4086fe8e148351fcf295f3ee13fc8c77112961fa"
"gitHead": "b3f3ef468142cd0168626a8eebb9070ea47c2c3f"
}
declare module '@m6web/react-i18n' {
import { ElementType } from 'react';
import { ElementType, Props } from 'react';
type TranslateRenderers = Record<string, ElementType>;
type TranslateFunction = (
key: string,
data: Record<string, any>,
number: number,
general: boolean,
renderers: TranslateRenderers,
) => string;
interface TranslateFunctionOptions {
data?: Record<string, any>;
number?: number;
general?: boolean;
renderers?: Record<string, ElementType>;
}
interface TranslateFunctionOptions {
data?: Record<string, any>;
number?: number;
general?: boolean;
renderers?: TranslateRenderers;
}
type TranslateFunction = (key: string, options?: TranslateFunctionOptions) => string;
interface I18nProviderProps {
lang: Record<string, string>;
interface I18nProviderProps {
lang: Record<string, string>;
i18nNames?: Record<string, string>;
errorCallback?: (combineKey: string) => void;
parseHTML?: boolean;
}
i18nNames?: Record<string, string>;
errorCallback?: (combineKey: string) => void;
parseHTML?: boolean;
}
interface TransProps extends TranslateFunctionOptions {
i18nKey: string;
}
interface TransProps extends TranslateFunctionOptions {
i18nKey: string;
}
interface HtmlTransProps extends TransProps {
element: string | ElementType;
}
interface HtmlTransProps extends TransProps {
element: string | ElementType;
}
type useTranslateFunction = (key: string, options?: TranslateFunctionOptions) => string;
interface TranslateProps {
t: TranslateFunction;
}
/* PUBLIC EXPORTS */
/* PUBLIC EXPORTS */
function translate(component: ElementType): ElementType;
function translate(component: ElementType): ElementType;
function useTranslate(): useTranslateFunction;
function useTranslate(): TranslateFunction;
function tFunction(
lang: Record<string, string>,
function tFunction(
lang: Record<string, string>,
i18nNames?: Record<string, string>,
errorCallback?: (combineKey: string) => void,
parseHTML?: boolean,
): TranslateFunction;
i18nNames?: Record<string, string>,
errorCallback?: (combineKey: string) => void,
parseHTML?: boolean,
): TranslateFunction;
const I18nProvider: ElementType<I18nProviderProps>;
const I18nProvider: ElementType<I18nProviderProps>;
const Trans: ElementType<TransProps>;
const Trans: ElementType<TransProps>;
const HtmlTrans: ElementType<HtmlTransProps>;
}
const HtmlTrans: ElementType<HtmlTransProps>;
}
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