mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-21 16:00:26 +01:00
Add option for disabling language autodetection
This commit is contained in:
@@ -35,5 +35,6 @@
|
||||
"allowPrivateGroups": 1,
|
||||
"unreadCutoff": 2,
|
||||
"bookmarkThreshold": 5,
|
||||
"topicsPerList": 20
|
||||
"topicsPerList": 20,
|
||||
"autoDetectLang": 1
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"language-settings": "Language Settings",
|
||||
"description": "The default language determines the language settings for all users who are visiting your forum. <br />Individual users can override the default language on their account settings page.",
|
||||
"default-language": "Default Language"
|
||||
"default-language": "Default Language",
|
||||
"auto-detect": "Auto Detect Language Setting for Guests"
|
||||
}
|
||||
@@ -18,6 +18,7 @@ languagesController.get = function (req, res, next) {
|
||||
|
||||
res.render('admin/general/languages', {
|
||||
languages: languages,
|
||||
autoDetectLang: parseInt(meta.config.autoDetectLang, 10) === 1,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -16,6 +16,17 @@
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<form class="row">
|
||||
<div class="form-group col-sm-6">
|
||||
<div class="checkbox">
|
||||
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||
<input class="mdl-switch__input" type="checkbox" data-field="autoDetectLang" <!-- IF autoDetectLang -->checked<!-- ENDIF autoDetectLang -->/>
|
||||
<span class="mdl-switch__label">[[admin/general/languages:auto-detect]]</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -206,7 +206,7 @@ function setupAutoLocale(app, callback) {
|
||||
});
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
if (parseInt(req.uid, 10) > 0) {
|
||||
if (parseInt(req.uid, 10) > 0 || parseInt(meta.config.autoDetectLang, 10) !== 1) {
|
||||
return next();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user