@smg-automotive/i18n-pkg
Advanced tools
Comparing version 1.2.0-marine-keys-translations-d199d4ed588db76df64483ce0294d57ac70c3180.2 to 1.2.0-marine-vsst-857-d5d54e5dbcf2d229e0239be090d8015ec61464c3.1
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { Dispatch, SetStateAction } from 'react'; | ||
export type Language = 'de' | 'fr' | 'it' | 'en'; | ||
@@ -14,2 +14,4 @@ type Params = { | ||
language: Language; | ||
displayTranslationKeys: boolean; | ||
setDisplayTranslationKeys: Dispatch<SetStateAction<boolean>>; | ||
} | ||
@@ -20,7 +22,6 @@ interface Props { | ||
onMissingTranslation: OnMissing; | ||
displayTranslationKeys?: boolean; | ||
} | ||
export declare const languages: Language[]; | ||
export declare const I18nContext: React.Context<ContextProps>; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, displayTranslationKeys, }: React.PropsWithChildren<Props>) => JSX.Element; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, }: React.PropsWithChildren<Props>) => JSX.Element; | ||
export default I18nProvider; |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { Dispatch, SetStateAction } from 'react'; | ||
export type Language = 'de' | 'fr' | 'it' | 'en'; | ||
@@ -14,2 +14,4 @@ type Params = { | ||
language: Language; | ||
displayTranslationKeys: boolean; | ||
setDisplayTranslationKeys: Dispatch<SetStateAction<boolean>>; | ||
} | ||
@@ -20,7 +22,6 @@ interface Props { | ||
onMissingTranslation: OnMissing; | ||
displayTranslationKeys?: boolean; | ||
} | ||
export declare const languages: Language[]; | ||
export declare const I18nContext: React.Context<ContextProps>; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, displayTranslationKeys, }: React.PropsWithChildren<Props>) => JSX.Element; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, }: React.PropsWithChildren<Props>) => JSX.Element; | ||
export default I18nProvider; |
@@ -53,7 +53,9 @@ 'use strict'; | ||
t: function (key) { return i18n.t(key); }, | ||
language: defaultLanguage | ||
language: defaultLanguage, | ||
displayTranslationKeys: false, | ||
setDisplayTranslationKeys: function () { return null; } | ||
}); | ||
i18n.locale(defaultLanguage); | ||
var I18nProvider = function (_a) { | ||
var children = _a.children, language = _a.language, lngDict = _a.lngDict, onMissingTranslation = _a.onMissingTranslation, displayTranslationKeys = _a.displayTranslationKeys; | ||
var children = _a.children, language = _a.language, lngDict = _a.lngDict, onMissingTranslation = _a.onMissingTranslation; | ||
i18n.locale(language); | ||
@@ -90,5 +92,8 @@ i18n.set(language, lngDict[language]); | ||
}; | ||
var _b = react.useState(false), displayTranslationKeys = _b[0], setDisplayTranslationKeys = _b[1]; | ||
var i18nWrapper = { | ||
t: t, | ||
language: language | ||
language: language, | ||
displayTranslationKeys: displayTranslationKeys, | ||
setDisplayTranslationKeys: setDisplayTranslationKeys | ||
}; | ||
@@ -95,0 +100,0 @@ return (jsxRuntime.jsx(I18nContext.Provider, tslib.__assign({ value: i18nWrapper }, { children: children }))); |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { Dispatch, SetStateAction } from 'react'; | ||
export type Language = 'de' | 'fr' | 'it' | 'en'; | ||
@@ -14,2 +14,4 @@ type Params = { | ||
language: Language; | ||
displayTranslationKeys: boolean; | ||
setDisplayTranslationKeys: Dispatch<SetStateAction<boolean>>; | ||
} | ||
@@ -20,7 +22,6 @@ interface Props { | ||
onMissingTranslation: OnMissing; | ||
displayTranslationKeys?: boolean; | ||
} | ||
export declare const languages: Language[]; | ||
export declare const I18nContext: React.Context<ContextProps>; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, displayTranslationKeys, }: React.PropsWithChildren<Props>) => JSX.Element; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, }: React.PropsWithChildren<Props>) => JSX.Element; | ||
export default I18nProvider; |
@@ -1,2 +0,2 @@ | ||
import { createContext, useContext, useMemo, Fragment, cloneElement } from 'react'; | ||
import { createContext, useState, useContext, useMemo, Fragment, cloneElement } from 'react'; | ||
import { __assign, __spreadArray } from 'tslib'; | ||
@@ -51,7 +51,9 @@ import { jsx } from 'react/jsx-runtime'; | ||
t: function (key) { return i18n.t(key); }, | ||
language: defaultLanguage | ||
language: defaultLanguage, | ||
displayTranslationKeys: false, | ||
setDisplayTranslationKeys: function () { return null; } | ||
}); | ||
i18n.locale(defaultLanguage); | ||
var I18nProvider = function (_a) { | ||
var children = _a.children, language = _a.language, lngDict = _a.lngDict, onMissingTranslation = _a.onMissingTranslation, displayTranslationKeys = _a.displayTranslationKeys; | ||
var children = _a.children, language = _a.language, lngDict = _a.lngDict, onMissingTranslation = _a.onMissingTranslation; | ||
i18n.locale(language); | ||
@@ -88,5 +90,8 @@ i18n.set(language, lngDict[language]); | ||
}; | ||
var _b = useState(false), displayTranslationKeys = _b[0], setDisplayTranslationKeys = _b[1]; | ||
var i18nWrapper = { | ||
t: t, | ||
language: language | ||
language: language, | ||
displayTranslationKeys: displayTranslationKeys, | ||
setDisplayTranslationKeys: setDisplayTranslationKeys | ||
}; | ||
@@ -93,0 +98,0 @@ return (jsx(I18nContext.Provider, __assign({ value: i18nWrapper }, { children: children }))); |
@@ -1,2 +0,2 @@ | ||
import React from 'react'; | ||
import React, { Dispatch, SetStateAction } from 'react'; | ||
@@ -15,2 +15,4 @@ type Language = 'de' | 'fr' | 'it' | 'en'; | ||
language: Language; | ||
displayTranslationKeys: boolean; | ||
setDisplayTranslationKeys: Dispatch<SetStateAction<boolean>>; | ||
} | ||
@@ -21,7 +23,6 @@ interface Props$1 { | ||
onMissingTranslation: OnMissing; | ||
displayTranslationKeys?: boolean; | ||
} | ||
declare const languages: Language[]; | ||
declare const I18nContext: React.Context<ContextProps>; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, displayTranslationKeys, }: React.PropsWithChildren<Props$1>) => JSX.Element; | ||
declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, }: React.PropsWithChildren<Props$1>) => JSX.Element; | ||
@@ -28,0 +29,0 @@ declare const useI18n: () => ContextProps; |
{ | ||
"name": "@smg-automotive/i18n-pkg", | ||
"version": "1.2.0-marine-keys-translations-d199d4ed588db76df64483ce0294d57ac70c3180.2", | ||
"version": "1.2.0-marine-vsst-857-d5d54e5dbcf2d229e0239be090d8015ec61464c3.1", | ||
"description": "A boilerplate package setup", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45944
533