@nanostores/i18n
Advanced tools
Comparing version 0.1.1 to 0.2.0
import { ReadableAtom } from 'nanostores' | ||
import { LocaleStore } from '../locale-from/index.js' | ||
import { Processor } from '../processor/index.js' | ||
@@ -73,3 +74,4 @@ export type TranslationJSON = string | TranslationsJSON | ||
get: TranslationLoader<Locale> | ||
processors?: Processor[] | ||
} | ||
): I18n<Locale> |
@@ -5,2 +5,3 @@ import { atom, onMount } from 'nanostores' | ||
let baseLocale = opts.baseLocale || 'en' | ||
let processors = opts.processors || [] | ||
let loading = atom(true) | ||
@@ -66,2 +67,7 @@ | ||
}) | ||
for (let i in processors) { | ||
processors[i].from.listen(() => { | ||
setTranslation(locale.get()) | ||
}) | ||
} | ||
return () => { | ||
@@ -68,0 +74,0 @@ unbindLocale() |
@@ -17,4 +17,5 @@ export { | ||
export { count, CountInput } from './count/index.js' | ||
export { createProcessor } from './processor/index.js' | ||
export { messagesToJSON } from './messages-to-json/index.js' | ||
export { browser } from './browser/index.js' | ||
export { params } from './params/index.js' |
export { transform, strings } from './transforms/index.js' | ||
export { createProcessor } from './processor/index.js' | ||
export { messagesToJSON } from './messages-to-json/index.js' | ||
@@ -3,0 +4,0 @@ export { createI18n } from './create-i18n/index.js' |
{ | ||
"name": "@nanostores/i18n", | ||
"version": "0.1.1", | ||
"description": "A tiny (<500 bytes) i18n library for React/Preact/Vue/Svelte", | ||
"version": "0.2.0", | ||
"description": "A tiny (≈500 bytes) i18n library for React/Preact/Vue/Svelte", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "nano", |
@@ -57,3 +57,3 @@ # Nano Stores I18n | ||
export const i18n = createI18n({ | ||
export const i18n = createI18n(locale, { | ||
get (code) { | ||
@@ -60,0 +60,0 @@ return fetchJSON(`/translations/${code}.json`) |
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
21441
23
593