@nanostores/i18n
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -20,3 +20,3 @@ import { atom, onMount } from 'nanostores' | ||
let t = atom(baseTranslation) | ||
let t = atom() | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -36,19 +36,19 @@ t.component = componentName | ||
onMount(t, () => { | ||
let waiting = false | ||
function setTranslation(code) { | ||
let translations = { | ||
...define.cache[baseLocale][componentName], | ||
...define.cache[code][componentName] | ||
} | ||
for (let i in transforms) { | ||
let nodeTransform = transforms[i] | ||
let input = translations[i] | ||
translations[i] = (...args) => nodeTransform(code, input, args) | ||
} | ||
t.set(translations) | ||
waiting = false | ||
let waiting = false | ||
function setTranslation(code) { | ||
let translations = { | ||
...define.cache[baseLocale][componentName], | ||
...define.cache[code][componentName] | ||
} | ||
for (let i in transforms) { | ||
let nodeTransform = transforms[i] | ||
let input = translations[i] | ||
translations[i] = (...args) => nodeTransform(code, input, args) | ||
} | ||
t.set(translations) | ||
waiting = false | ||
} | ||
setTranslation(baseLocale) | ||
onMount(t, () => { | ||
let unbindLocale = locale.subscribe(code => { | ||
@@ -55,0 +55,0 @@ if (define.cache[code]) { |
@@ -6,4 +6,4 @@ import { ReadableAtom } from 'nanostores' | ||
export interface Formatter { | ||
number: Intl.NumberFormat['format'] | ||
time: Intl.DateTimeFormat['format'] | ||
number(num: number, opts?: Intl.NumberFormatOptions): string | ||
time(date?: Date | number, opts?: Intl.DateTimeFormatOptions): string | ||
} | ||
@@ -10,0 +10,0 @@ |
{ | ||
"name": "@nanostores/i18n", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A tiny (≈500 bytes) i18n library for React/Preact/Vue/Svelte", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21487
594