From 970aafecb41743cce35959fe385aec9f04ab9b53 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 5 Sep 2014 00:15:37 +0200 Subject: [PATCH] FIX: Some default group names could not be translated --- .../discourse/routes/discovery_categories_route.js | 2 +- app/models/group.rb | 11 +++++++---- config/locales/client.en.yml | 1 + config/locales/server.en.yml | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/routes/discovery_categories_route.js b/app/assets/javascripts/discourse/routes/discovery_categories_route.js index dbe476455b4..6ddf7e92bd8 100644 --- a/app/assets/javascripts/discourse/routes/discovery_categories_route.js +++ b/app/assets/javascripts/discourse/routes/discovery_categories_route.js @@ -46,7 +46,7 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos actions: { createCategory: function() { Discourse.Route.showModal(this, 'editCategory', Discourse.Category.create({ - color: 'AB9364', text_color: 'FFFFFF', group_permissions: [{group_name: 'everyone', permission_type: 1}], + color: 'AB9364', text_color: 'FFFFFF', group_permissions: [{group_name: I18n.t('category.everyone_permission'), permission_type: 1}], available_groups: Discourse.Site.current().group_names, allow_badges: true })); diff --git a/app/models/group.rb b/app/models/group.rb index 14138ba148f..498733cc1e4 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -70,10 +70,6 @@ class Group < ActiveRecord::Base group.save! end - # the everyone group is special, it can include non-users so there is no - # way to have the membership in a table - return group if name == :everyone - group.name = I18n.t("groups.default_names.#{name}") # don't allow shoddy localization to break this @@ -82,6 +78,13 @@ class Group < ActiveRecord::Base group.name = name end + # the everyone group is special, it can include non-users so there is no + # way to have the membership in a table + if name == :everyone + group.save! + return group + end + # Remove people from groups they don't belong in. # # BEWARE: any of these subqueries could match ALL the user records, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 0b46f3e8066..eab871491e2 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1265,6 +1265,7 @@ en: allow_badges_label: "Allow badges to be awarded in this category" edit_permissions: "Edit Permissions" add_permission: "Add Permission" + everyone_permission: "everyone" this_year: "this year" position: "position" default_position: "Default Position" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 53670b1555b..639ce4097eb 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -120,14 +120,15 @@ en: errors: can_not_modify_automatic: "You can not modify an automatic group" default_names: + everyone: "everyone" admins: "admins" moderators: "moderators" staff: "staff" + trust_level_0: "trust_level_0" trust_level_1: "trust_level_1" trust_level_2: "trust_level_2" trust_level_3: "trust_level_3" trust_level_4: "trust_level_4" - trust_level_5: "trust_level_5" education: until_posts: