-
Notifications
You must be signed in to change notification settings - Fork 80
Language selection #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Please review and merge. |
Looks cool. Need to consider if it should be bundled with the package though or just downloaded from docs manually. Some users might not want the increased bundle size. The json-autotranslate stuff looks really useful. Anyway as far as merging goes I’m working a big PR (2.0) with a lot of changes and organization plugin that I need to finish and merge first before I can merge this. Also need to get some feedback from some other devs on how they want this integrated. I can almost predict that some users won’t like the bundle size being increased by unused locales, so maybe it needs to be a different package. Then you could just pass it as locales={authUILocales[lang]} |
@MatteoGauthier was curious if you have any feedback for this |
I understand. import { authUILocales, useBrowserLocale } from "@daveyplate/better-auth-ui/locales"
<AuthCard
pathname={pathname}
localization={{
// if you want to use a specific language.
// you can refer to ../languages.md
...authUILocales.zh,
// if you want to use the browser language
...useBrowserLocale(),
// if you want to use a specify word, sentence, you can do as follows
// you can refer to https://github.com/daveyplate/better-auth-ui/blob/main/src/lib/auth-localization.ts
passwordInvalid: "Password must contain XXXX"
}}
/> |
I know some people will want to customize their localization strings, so my plan is to provide an easy option for automatically translating all their custom text seamlessly. For example, let's say someone changes the default localization strings (renames Organization to Team, Sign In to Login, custom instructions for various settings, etc.) then they will need new translations for all of that as well, and won't want to use the default translations. My end goal is to have a plug and play solution to translate everything dynamically on the fly, and also providing these as defaults for devs who don't care about customizing the strings. Just so you know what I'm thinking here. Anyway I'm still grinding through a pretty big PR with Organization, Stripe, Polar, etc for 2.0 that also has some deprecations and a few breaking changes, so I might not have time to fully review this until I'm done. In the meantime I'd suggest just making your own class to import your JSON translations on the fly and providing it to the localization prop until I can finish these patches. |
Following are my idea. I can mannage by A Custom Translation or i18n which I use for other translation. A. Custom Translation
B. Default Translation
I think this is necessary as some competitors (supabase, clerk, auth0) do as same. |
I made features as we talked in #96
some are overwrapping with #85