Plume-org / rocket_i18n

A crate to help you internationalize your Rocket applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Correctly parse local from client

trinity-1686a opened this issue · comments

Currently client's local is determined by the first local before a comma, but local may contain not only language but also country and some sort of priority tag. Those should get stripped before calling set_var. For exemple when connecting to a Plume instance, as my exact local is fr-FR,en-US;q=0.7,en;q=0.3, set_var is called on fr-FR, but translation is only available for fr, so I get default language instead of french.
How to reproduce :

$ curl https://baptiste.gelez.xyz/ -H "Accept-Language: fr" | grep h1
$ curl https://baptiste.gelez.xyz/ -H "Accept-Language: fr-FR" | grep h1

Notice one is in french, the other in english