Anbarryprojects / fastapi-babel

FastAPI babel support pybable tools like translation of text, formatting of dates, times and numbers, and time zones.
MIT License
46 stars 14 forks source link

Fix setting language over header #19 #23

Closed beu-adesso closed 1 year ago

beu-adesso commented 1 year ago

The header Accept-Language can now accept a language better.
Therefore it looks in the language folder for available Languages and accepts them only if there are present in this folder.
If the language is not present it uses the default language.

Another feature is that it is using the language with the highest quality value.
It Accepts languages in the formats en and en-US. The quality value can be appended to booth formats.
The example mentioned in issue #19 'en-US,en;q=0.7,hu;q=0.3' will be accepted

beu-adesso commented 1 year ago

To test or use this feature in your project you can add it to your poetry project by executing:

poetry add git+https://github.com/beu-adesso/fastapi-babel.git
Legopapurida commented 1 year ago

To test or use this feature in your project you can add it to your poetry project by executing:

poetry add git+https://github.com/beu-adesso/fastapi-babel.git

This feature can be so helpful. Thanks a lot for I will try this and add it to the repo readme.

Legopapurida commented 1 year ago

Yes, we had such an error in used projects from others, I reviewed this and I merged your pull requests.