@nanostores/i18n
Advanced tools
Comparing version 0.1.0 to 0.1.1
import { ReadableAtom } from 'nanostores' | ||
type A = Extract<'fr' | 'ru', 'en'> | ||
type AutodetectOpts<Locales extends readonly string[]> = Extract< | ||
@@ -6,0 +4,0 @@ Locales[number], |
@@ -19,10 +19,17 @@ import { atom, onMount } from 'nanostores' | ||
define.cache[baseLocale][componentName] = baseTranslation | ||
let t = atom(baseTranslation) | ||
if (process.env.NODE_ENV !== 'production') { | ||
t.component = componentName | ||
t.base = base | ||
if (define.cache[baseLocale][componentName]) { | ||
throw new Error( | ||
`I18n component ${componentName} was defined multiple times. ` + | ||
'It could lead to cache issues. Try to move i18n definition from ' + | ||
'component’s render function.' | ||
) | ||
} | ||
} | ||
define.cache[baseLocale][componentName] = baseTranslation | ||
onMount(t, () => { | ||
@@ -29,0 +36,0 @@ let waiting = false |
{ | ||
"name": "@nanostores/i18n", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A tiny (<500 bytes) i18n library for React/Preact/Vue/Svelte", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -22,3 +22,3 @@ # Nano Stores I18n | ||
import { params, count } from '@nanostores/i18n' // You can use own functions | ||
import { useStore } from 'nanostores' | ||
import { useStore } from '@nanostores/react' | ||
import { i18n, format } from '../stores/i18n.js' | ||
@@ -76,3 +76,4 @@ | ||
} | ||
} | ||
}, | ||
// Translations for all other components | ||
} | ||
@@ -79,0 +80,0 @@ ``` |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
19661
527
92
3