Add support for locale_behavior: "respect_accept_language"
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react, typescript
- Área
- frontend, internationalization
Línea de trabajo
Empieza en packages/elements-react/src/context/provider.tsx, alrededor de la configuración de intl.locale, e inspecciona el área existente de utils para el manejo de locales. Sigue cómo el default OryProvider recibe la configuración y, después, define cómo debe analizarse accept-language y compararse con project.enabled_locales. Se considera terminado cuando respect_accept_language selecciona esa locale de forma predeterminada, mientras que un valor de configuración explícito sigue sobrescribiéndola.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe your problem
Currently, it seems like this mode is not supported, since there are no references to the "accept-language" header in the library.
In fact, it is not the key: project.default_locale which is used (as the name would perhaps suggest), but the intl.locale config key https://github.com/ory/elements/blob/795b1bda1f7236874fb7686f5fbf51237ff290a1/packages/elements-react/src/context/provider.tsx#L83.
Describe your ideal solution
I would expect the behaviour of the default OryProvider to interpret the "accept-language" header in "respect_accept_language" mode, and use that as the default application language, unless otherwise overridden in the config object.
I imagine that this would entail adding another function to "utils" which parses the header and possibly cross-references it with the project.enabled_locales array from config. Once this approach is approved, I'd be happy to open a PR.
Workarounds or alternatives
I was looking at using window.navigator.language as an alternative but this would mean that the config object would need to be rendered client-side.
Version
main 795b1bda1f7236874fb7686f5fbf51237ff290a1
Additional Context
No response
- Lenguaje dominante
- TypeScript
- Estrellas
- 187
- Forks
- 80
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ory/elements
-
Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
good first issue help wanted upstream
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
-
good first issue help wanted upstream
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
-
Add React-only examplesAbiertoNeeds Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
-
guessPotentiallyProxiedOrySdkUrl breaks flows in production behind a non-Vercel reverse proxyAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de ory/elements
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
melgarafael/DeskcommCRM#1812 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
prisma/prisma-cli#309 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
gregwebs/pi-quota-dispatcher#26 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
openwatersio/slackwater.xyz#124 ·
Los mantenedores suelen responder en 1 día
-
agent-reported area/browser area/docs documentation good first issue hacktoberfest help wanted P2
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 2 días