@smg-automotive/i18n-pkg
Advanced tools
Comparing version 1.2.0 to 1.3.0-talamcol-safe-parse-language-cc2342f600071bdcb432b5aba7169c0f6ff1a774.1
'use strict'; | ||
var react = require('react'); | ||
var tslib = require('tslib'); | ||
var jsxRuntime = require('react/jsx-runtime'); | ||
var react = require('react'); | ||
var dlv=function(t,e,l,n,o){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:o;return t===o?l:t}; | ||
function dlv(t,e,l,n,r){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:r;return t===r?l:t} | ||
@@ -101,2 +101,8 @@ const RGX = /{{(.*?)}}/g; | ||
var safeParseLanguage = (function (language) { | ||
if (languages.includes(language)) | ||
return language; | ||
return defaultLanguage; | ||
}); | ||
var useI18n = function () { | ||
@@ -175,5 +181,7 @@ var i18n = react.useContext(I18nContext); | ||
exports.Trans = Trans; | ||
exports.defaultLanguage = defaultLanguage; | ||
exports.filterDictionaryScopes = filterDictionaryScopes; | ||
exports.languages = languages; | ||
exports.safeParseLanguage = safeParseLanguage; | ||
exports.useI18n = useI18n; | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,6 @@ | ||
import { createContext, useState, useContext, useMemo, Fragment, cloneElement } from 'react'; | ||
import { __assign, __spreadArray } from 'tslib'; | ||
import { jsx } from 'react/jsx-runtime'; | ||
import { createContext, useState, useContext, useMemo, Fragment, cloneElement } from 'react'; | ||
var dlv=function(t,e,l,n,o){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:o;return t===o?l:t}; | ||
function dlv(t,e,l,n,r){for(e=e.split?e.split("."):e,n=0;n<e.length;n++)t=t?t[e[n]]:r;return t===r?l:t} | ||
@@ -99,2 +99,8 @@ const RGX = /{{(.*?)}}/g; | ||
var safeParseLanguage = (function (language) { | ||
if (languages.includes(language)) | ||
return language; | ||
return defaultLanguage; | ||
}); | ||
var useI18n = function () { | ||
@@ -170,3 +176,3 @@ var i18n = useContext(I18nContext); | ||
export { I18nContext, I18nProvider, Trans, filterDictionaryScopes, languages, useI18n }; | ||
export { I18nContext, I18nProvider, Trans, defaultLanguage, filterDictionaryScopes, languages, safeParseLanguage, useI18n }; | ||
//# sourceMappingURL=index.js.map |
import React, { Dispatch, SetStateAction } from 'react'; | ||
type Language = 'de' | 'fr' | 'it' | 'en'; | ||
declare const _default$1: (language: string | undefined | null) => "de" | "fr" | "it" | "en"; | ||
declare const languages: readonly ["de", "fr", "it", "en"]; | ||
type Language = (typeof languages)[number]; | ||
declare const defaultLanguage: Language; | ||
type Params = { | ||
@@ -23,3 +27,2 @@ count?: number | string; | ||
} | ||
declare const languages: Language[]; | ||
declare const I18nContext: React.Context<ContextProps>; | ||
@@ -50,2 +53,2 @@ declare const I18nProvider: ({ children, language, lngDict, onMissingTranslation, }: React.PropsWithChildren<Props$1>) => JSX.Element; | ||
export { I18nContext, I18nProvider, Language, Trans, _default as filterDictionaryScopes, languages, useI18n }; | ||
export { I18nContext, I18nProvider, Language, Trans, defaultLanguage, _default as filterDictionaryScopes, languages, _default$1 as safeParseLanguage, useI18n }; |
{ | ||
"name": "@smg-automotive/i18n-pkg", | ||
"version": "1.2.0", | ||
"version": "1.3.0-talamcol-safe-parse-language-cc2342f600071bdcb432b5aba7169c0f6ff1a774.1", | ||
"description": "A boilerplate package setup", | ||
@@ -16,3 +16,3 @@ "main": "dist/cjs/index.js", | ||
"version": "npm run build", | ||
"build": "rimraf dist && rollup --bundleConfigAsCjs -c", | ||
"build": "rimraf dist && rollup -c", | ||
"lint": "eslint --ext ts,js,tsx,jsx,json .", | ||
@@ -32,20 +32,20 @@ "format": "npm run lint -- --fix", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "23.0.7", | ||
"@rollup/plugin-commonjs": "24.0.1", | ||
"@rollup/plugin-node-resolve": "15.0.1", | ||
"@rollup/plugin-typescript": "9.0.2", | ||
"@smg-automotive/eslint-config": "2.0.43", | ||
"@rollup/plugin-typescript": "11.0.0", | ||
"@smg-automotive/eslint-config": "3.0.3", | ||
"@testing-library/jest-dom": "5.16.5", | ||
"@testing-library/react": "13.4.0", | ||
"@testing-library/user-event": "14.4.3", | ||
"@types/jest": "29.2.4", | ||
"jest": "29.3.1", | ||
"jest-environment-jsdom": "29.3.1", | ||
"rimraf": "3.0.2", | ||
"rollup": "3.7.5", | ||
"rollup-plugin-dts": "5.0.0", | ||
"@types/jest": "29.4.0", | ||
"jest": "29.4.2", | ||
"jest-environment-jsdom": "29.4.2", | ||
"rimraf": "4.1.2", | ||
"rollup": "3.15.0", | ||
"rollup-plugin-dts": "5.2.0", | ||
"rollup-plugin-peer-deps-external": "2.2.4", | ||
"semantic-release": "19.0.5", | ||
"ts-jest": "29.0.3", | ||
"semantic-release": "20.1.0", | ||
"ts-jest": "29.0.5", | ||
"ts-node": "10.9.1", | ||
"typescript": "4.9.4" | ||
"typescript": "4.9.5" | ||
}, | ||
@@ -55,3 +55,3 @@ "peerDependencies": { | ||
"react-dom": "18.2.0", | ||
"tslib": "2.4.1" | ||
"tslib": "2.5.0" | ||
}, | ||
@@ -58,0 +58,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
47773
27
559
2