From b4f500333f724291d62eda9c9a9647a8f03d9814 Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 18 Sep 2015 08:38:12 -0700 Subject: [PATCH] Assign pt-BR or zh-HANS for those domains --- server/routes/auth.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/routes/auth.coffee b/server/routes/auth.coffee index 3ce08b614..1df02daa5 100644 --- a/server/routes/auth.coffee +++ b/server/routes/auth.coffee @@ -202,6 +202,8 @@ module.exports.makeNewUser = makeNewUser = (req) -> user.set 'testGroupNumber', Math.floor(Math.random() * 256) # also in app/core/auth lang = languages.languageCodeFromAcceptedLanguages req.acceptedLanguages user.set 'preferredLanguage', lang if lang[...2] isnt 'en' + user.set 'preferredLanguage', 'pt-BR' if not user.get('preferredLanguage') and /br\.codecombat\.com/.test(req.get('host')) + user.set 'preferredLanguage', 'zh-HANS' if not user.get('preferredLanguage') and /cn\.codecombat\.com/.test(req.get('host')) user.set 'lastIP', (req.headers['x-forwarded-for'] or req.connection.remoteAddress)?.split(/,? /)[0] user.set 'chinaVersion', true if req.chinaVersion #log.info "making new user #{user.get('_id')} with language #{user.get('preferredLanguage')} of #{req.acceptedLanguages} and chinaVersion #{req.chinaVersion} on #{if config.tokyo then 'Tokyo' else 'US'} server and lastIP #{req.connection.remoteAddress}."