bigbag / starlette-i18n Goto Github PK
View Code? Open in Web Editor NEWLocalisation helper for starlette
License: Apache License 2.0
Localisation helper for starlette
License: Apache License 2.0
Hi,
In case of complex language codes in Accept-Language
header, f.ex. es-419
, zh-CN
, pt-BR
, zh-TW
LocaleFromHeaderMiddleware
falls back to English even if valid folders with translations are present in locales
dir. I was able to fix it here: main...r4fek:starlette-i18n:main#diff-0a2167031d28db7308f3855e50ffd9154a327d22042f80d0ebf67a283fb622be
but you may want to take a closer look into this.
I can prepare a MR if you like.
Hi @bigbag,
first of all, thank you for this package, I was struggling with this i18n stuff!
I don't know if there is a good reason to set starlette
version to the last one, but if it is not the case, can you consider downgrade it to something like starlette>=14.0.0
? This will make some FastAPI users happy since the latter will always be late to catch up starlette version.
Do I understand correctly that starlette-i18n cannot provide more than one translation locale at a time? Examples here also deliver only one extra locale besides English as the default language. Is that intentional and expresses a limitation of using starlette-i18n and more generally jinja2.ext.i18n for ASGI frameworks like Starlette?
I found related discussions at encode/starlette#279 (comment) and pallets/jinja#1323 (comment), but maybe you @bigbag as the author of this localisation helper have further comments and maybe some practical suggestions on this?
Do you have an example of using this with Jinja2 templates? I found this discussion saying to use dictionaries to translate in templates but perhaps there is a better way with your project. encode/starlette#279
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.