mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 13:17:20 -05:00
Add a site setting to allow users to toggle I18n.locale
It is false by default.
This commit is contained in:
@@ -11,6 +11,10 @@ Discourse.PreferencesController = Discourse.ObjectController.extend({
|
||||
return Discourse.SiteSettings.allow_uploaded_avatars;
|
||||
}.property(),
|
||||
|
||||
allowUserLocale: function() {
|
||||
return Discourse.SiteSettings.allow_user_locale;
|
||||
}.property(),
|
||||
|
||||
// By default we haven't saved anything
|
||||
saved: false,
|
||||
|
||||
|
||||
@@ -66,15 +66,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{i18n user.locale.title}}</label>
|
||||
<div class="controls">
|
||||
{{combobox valueAttribute="value" content=availableLocales value=locale none="user.locale.default"}}
|
||||
{{#if allowUserLocale}}
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{i18n user.locale.title}}</label>
|
||||
<div class="controls">
|
||||
{{combobox valueAttribute="value" content=availableLocales value=locale none="user.locale.default"}}
|
||||
</div>
|
||||
<div class='instructions'>
|
||||
{{i18n user.locale.instructions}}
|
||||
</div>
|
||||
</div>
|
||||
<div class='instructions'>
|
||||
{{i18n user.locale.instructions}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="control-group">
|
||||
<label class="control-label">{{i18n user.bio}}</label>
|
||||
|
||||
@@ -109,7 +109,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def set_locale
|
||||
I18n.locale = if current_user && current_user.locale.present?
|
||||
I18n.locale = if SiteSetting.allow_user_locale && current_user && current_user.locale.present?
|
||||
current_user.locale
|
||||
else
|
||||
SiteSetting.default_locale
|
||||
|
||||
Reference in New Issue
Block a user