Merge branch 'master' into master

This commit is contained in:
Kim Gardner
2018-01-04 11:20:57 -05:00
committed by GitHub
3 changed files with 14 additions and 3 deletions
+2 -2
View File
@@ -319,7 +319,7 @@ default to providing only a time based lockout. Refer to
[reCAPTCHA](https://www.google.com/recaptcha/intro/index.html) for information
on getting an account setup.
## TALK_REDIS_CLIENT_CONFIG
## TALK_REDIS_CLIENT_CONFIGURATION
Configuration overrides for the redis client configuration in a JSON encoded
string. Configuration is overridden as the second parameter to the redis client
@@ -466,4 +466,4 @@ same as any other user in the system. (Default `FALSE`)
The prefix for the subject of emails sent. An email with the specified subject
of `Email Confirmation` would then be sent as `[Talk] Email Confirmation`.
(Default `[Talk]`)
(Default `[Talk]`)
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "talk",
"version": "3.9.0",
"version": "3.9.1",
"description": "A better commenting experience from Mozilla, The New York Times, and the Washington Post. https://coralproject.net",
"main": "app.js",
"private": true,
+11
View File
@@ -32,6 +32,14 @@ let translations = fs.readdirSync(resolve())
// Create a list of all supported translations.
const languages = Object.keys(translations);
// Move the default language to the front.
if (languages.includes(DEFAULT_LANG)) {
const from = languages.indexOf(DEFAULT_LANG);
languages.splice(from, 1);
languages.splice(0, 0, DEFAULT_LANG);
}
debug(`loaded language sets for ${languages}`);
let loadedPluginTranslations = false;
const loadPluginTranslations = () => {
if (loadedPluginTranslations) {
@@ -80,8 +88,11 @@ const t = (language) => (key, ...replacements) => {
*/
const i18n = {
request(req) {
debug(`possible languages given request '${accepts(req).languages()}'`);
const lang = accepts(req).language(languages);
debug(`parsed request language as '${lang}'`);
const language = lang ? lang : DEFAULT_LANG;
debug(`decided language as '${language}'`);
return t(language);
},