-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestspikeRequires exploring potential solutionsRequires exploring potential solutionstChanges regarding the `t` packageChanges regarding the `t` package
Description
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).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestspikeRequires exploring potential solutionsRequires exploring potential solutionstChanges regarding the `t` packageChanges regarding the `t` package