Home

Issue: 707

i18n should not be like this?

[issue link]

As mentioned in the i18n example https://github.com/nuxt/nuxt.js/blob/master/examples/i18n/middleware/i18n.js

...
const locale = params.lang || 'en'
...

So the lang is in url params like http://xxxx/en/xxxxxx

But I think the lang should be identified from the client browser, not as a param.

So I change this to:

const locale = (window.navigator.language || window.navigator.browserLanguage).toLowerCase() || 'en'

But I got error window is not defiend, because this code is run in server.

So what should I do to get the lang from user’s client? thanks!

This question is available on Nuxt.js community (#c601)