Commit bba0025c7c18c57a6f79f153fd86a01ba14cc7cd
Use the date format the browser requests instead of only the ones for which there is a translation
Anders Rune Jensen committed on 12/26/2016, 3:42:50 PMParent: f9c88aecad058003d92879bff90545a8b8d9799c
Files changed
index.js | changed |
index.js | |||
---|---|---|---|
@@ -211,12 +211,17 @@ | |||
211 | 211 … | req._u = url.parse(req.url, true) | |
212 | 212 … | var locale = req._u.query.locale || | |
213 | 213 … | (/locale=([^;]*)/.exec(req.headers.cookie) || [])[1] | |
214 | 214 … | var reqLocales = req.headers['accept-language'] | |
215 … | + var locales = String(reqLocales).split(/, */).map(function (item) { | ||
216 … | + return item.split(';')[0] | ||
217 … | + }) | ||
218 … | + if (locales) | ||
219 … | + req._locale = locales[0] | ||
220 … | + | ||
215 | 221 … | this.i18n.pickCatalog(reqLocales, locale, function (err, t) { | |
216 | 222 … | if (err) return pull(this.serveError(req, err, 500), serve(req, res)) | |
217 | 223 … | req._t = t | |
218 | - req._locale = t.locale | ||
219 | 224 … | pull(this.handleRequest(req), serve(req, res)) | |
220 | 225 … | }.bind(this)) | |
221 | 226 … | } | |
222 | 227 … |
Built with git-ssb-web