Closed Benehiko closed 9 months ago
This is already possible & documented:
We could improve the docs to show how the default translations can be extended instead:
import { IntlProvider } from "react-intl" import { locales } from "@ory/elements" const customMessages = { ...locales, de: { ...locales.de, "login.title": "Login", }, } const Main = () => { return ( <IntlProvider locale={customMessageLocale} messages={customMessages}> <Router> <Route path="/" component={Dashboard} /> {/* ... */} </Router> </IntlProvider> ) }
I agree that we do support it, but it requires the user implementing the library to directly use react-intl
.
In an optimal path scenario I can see more users wanting to only use a copy paste example with defaults and the option to override some labels, such as the login ID
-> Email
for example.
The path to reach this use case in the current method isn't as obvious and a bit confusing, especially if you have no idea which keys do what. What if we introduce breaking changes later on inside the translations? or special formatting like we do here https://github.com/ory/elements/blob/main/src/react-components/provider.tsx#L50-L52
I'm not against the current way and I think supporting it makes sense to give users a choice and the ability to customize the translation layer themselves. But a happy path must exist and i don't think the current implementation is that happy path.
Adds custom language support to the
IntlProvider
. This allows users ofory/elements
to specify and provide their own custom translations without needing to add it to theory/elements
repository.Related Issue or Design Document
Checklist
Further comments