AloisSeckar / WBSC-Scoring

Visualisation tool for WBSC scoring system
The Unlicense
2 stars 2 forks source link

Automatic language selection #229

Open lucafano04 opened 1 month ago

lucafano04 commented 1 month ago

This is more a proof of concept, I will probably make a PR with this feature, but the website could be decoding the Accept-Language header and if it is the first time the user access to the website the language will be auto-switched. I would like to discuss this feature before starting to work on it.

AloisSeckar commented 1 month ago

I was thinking about implementing when I was introducing i18n, but I wasn't able to figure it out quickly, so I left it due later.

We are currently fall-backing to english only, because of this in app.vue:

35: const storedLocale = useLocalStorage('wbsc-lang', 'en')

Normally, i18n module has a built-in support for this, but it uses a cookie, which implies having to implement cookie law banner to satisfy EU regulations :/

If you are able to read the mentioned header and get the value from it (I am not quite sure, how to do it in Nuxt client-side), I am looking forward to the PR 👀