mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
got basic i18n working in express
This commit is contained in:
parent
2968fbcfff
commit
063a583ad3
4 changed files with 11 additions and 2 deletions
|
@ -7,6 +7,7 @@ Server = require("./app/js/infrastructure/Server")
|
|||
BackgroundTasks = require("./app/js/infrastructure/BackgroundTasks")
|
||||
Errors = require "./app/js/errors"
|
||||
|
||||
|
||||
argv = require("optimist")
|
||||
.options("user", {alias : "u", description : "Run the server with permissions of the specified user"})
|
||||
.options("group", {alias : "g", description : "Run the server with permissions of the specified group"})
|
||||
|
|
|
@ -48,6 +48,10 @@ module.exports = (app)->
|
|||
res.locals.settings = Settings
|
||||
next()
|
||||
|
||||
app.use (req, res, next)->
|
||||
res.locals.translate = req.i18n.translate
|
||||
next()
|
||||
|
||||
app.use (req, res, next)->
|
||||
res.locals.getSiteHost = ->
|
||||
Settings.siteUrl.substring(Settings.siteUrl.indexOf("//")+2)
|
||||
|
|
|
@ -15,6 +15,8 @@ sessionStore = new RedisStore(host:Settings.redis.web.host, port:Settings.redis.
|
|||
cookieParser = express.cookieParser(Settings.security.sessionSecret)
|
||||
oneDayInMilliseconds = 86400000
|
||||
ReferalConnect = require('../Features/Referal/ReferalConnect')
|
||||
i18n = require("i18next")
|
||||
i18n.init(resGetPath: 'locales/__lng__/__ns__.json')
|
||||
|
||||
Monitor = require "./Monitor"
|
||||
|
||||
|
@ -40,6 +42,7 @@ app.configure ()->
|
|||
app.set 'views', __dirname + '/../../views'
|
||||
app.set 'view engine', 'jade'
|
||||
app.use express.bodyParser(uploadDir: __dirname + "/../../../data/uploads")
|
||||
app.use i18n.handle
|
||||
app.use cookieParser
|
||||
app.use express.session
|
||||
proxy: true
|
||||
|
|
|
@ -32,12 +32,13 @@
|
|||
"fairy": "0.0.2",
|
||||
"node-uuid": "1.4.0",
|
||||
"mongojs": "0.9.8",
|
||||
"nodemailer": "0.6.1",
|
||||
"nodemailer": "0.6.1",
|
||||
"bcrypt": "0.7.5",
|
||||
"archiver": "0.5.1",
|
||||
"nodetime": "0.8.15",
|
||||
"mocha": "1.17.1",
|
||||
"redback": "0.3.7"
|
||||
"redback": "0.3.7",
|
||||
"i18next": "~1.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "",
|
||||
|
|
Loading…
Reference in a new issue