git ssb

30+

cel / git-ssb-web



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 PM
Parent: f9c88aecad058003d92879bff90545a8b8d9799c

Files changed

index.jschanged
index.jsView
@@ -211,12 +211,17 @@
211211 req._u = url.parse(req.url, true)
212212 var locale = req._u.query.locale ||
213213 (/locale=([^;]*)/.exec(req.headers.cookie) || [])[1]
214214 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 +
215221 this.i18n.pickCatalog(reqLocales, locale, function (err, t) {
216222 if (err) return pull(this.serveError(req, err, 500), serve(req, res))
217223 req._t = t
218- req._locale = t.locale
219224 pull(this.handleRequest(req), serve(req, res))
220225 }.bind(this))
221226 }
222227

Built with git-ssb-web