Open macarie opened 8 months ago
With a nanostores-like interface:
const { locale, translations, t, useTranslations } = defineTranslationsConfig(...) locale.listen((locale) => { console.log('new locale set:', locale) }) translations.listen((translations) => { valibot.setGlobalMessage((issue) => t(translations.errors.generic, { input: issue.message })) }) console.log( t( await (translations.get()) .article .heading .publishedBy, { ... } ) ) const Component = () => { const heading = useTranslations(translations, 'article.heading') // or like it is now const heading = useTranslations('article.heading') return <span>{t(heading.publishedBy, { name })}</span> }
With this interface, it's possible to remove the get* functions and builders, greatly simplifying both the t package and the adapters (~> also allowing the removal of the setup parameter).
get*
t
setup
This feature would also solve #17.
With a nanostores-like interface:
With this interface, it's possible to remove the
get*
functions and builders, greatly simplifying both thet
package and the adapters (~> also allowing the removal of thesetup
parameter).