mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
126 stars 41 forks source link

Get the current lang from the URL into the i18n middleware #9631

Closed muffinresearch closed 8 years ago

muffinresearch commented 8 years ago

Currently the new translation provider + middleware (WiP) is quite basic and takes the lang from a query-string (QS).

For the disco pane we want the first part of the path to give us the locale which is the typical mozilla approach.

I suspect we'll want to do the following (in order of priority).

This issue should cover updating the middelware to handle that.

i18n-abide should provide most of the logic.

Open questions. Should we munge the path like i18n-abide does?

FWIW we're not currently using i18n-abide because it deals with the translations in a different way to our univesral setup allow a lot of our utils are based on theirs.

mstriemer commented 8 years ago

We should be able to pull the locale from the URL when we are inside of the match call with renderProps.params.locale. This would of course not work if there was no locale set in the current URL so we might want some list of fallbacks. I guess we could fallback to renderProps.params.query.lang then a default of en-US most likely.