Merge pull request #3981 from gschlager/uncategorized_description

Replace uncategorized_description setting with translation
This commit is contained in:
Régis Hanol 2016-01-28 10:36:10 +01:00
commit 5c52beeaf2
4 changed files with 13 additions and 3 deletions

View File

@ -26,7 +26,7 @@ class BasicCategorySerializer < ApplicationSerializer
end end
def description def description
object.uncategorized? ? SiteSetting.uncategorized_description : object.description object.uncategorized? ? I18n.t('category.uncategorized_description') : object.description
end end
def can_edit def can_edit

View File

@ -364,6 +364,7 @@ en:
one: "Can't delete this category because is has 1 topic. Oldest topic is %{topic_link}." one: "Can't delete this category because is has 1 topic. Oldest topic is %{topic_link}."
other: "Can't delete this category because it has %{count} topics. Oldest topic is %{topic_link}." other: "Can't delete this category because it has %{count} topics. Oldest topic is %{topic_link}."
topic_exists_no_oldest: "Can't delete this category because topic count is %{count}." topic_exists_no_oldest: "Can't delete this category because topic count is %{count}."
uncategorized_description: "Topics that don't need a category, or don't fit into any other existing category."
trust_levels: trust_levels:
newuser: newuser:
title: "new user" title: "new user"
@ -764,7 +765,6 @@ en:
min_search_term_length: "Minimum valid search term length in characters" min_search_term_length: "Minimum valid search term length in characters"
search_tokenize_chinese_japanese_korean: "Force search to tokenize Chinese/Japanese/Korean even on non CJK sites" search_tokenize_chinese_japanese_korean: "Force search to tokenize Chinese/Japanese/Korean even on non CJK sites"
allow_uncategorized_topics: "Allow topics to be created without a category. WARNING: If there are any uncategorized topics, you must recategorize them before turning this off." allow_uncategorized_topics: "Allow topics to be created without a category. WARNING: If there are any uncategorized topics, you must recategorize them before turning this off."
uncategorized_description: "The description of the uncategorized category. Leave blank for no description."
allow_duplicate_topic_titles: "Allow topics with identical, duplicate titles." allow_duplicate_topic_titles: "Allow topics with identical, duplicate titles."
unique_posts_mins: "How many minutes before a user can make a post with the same content again" unique_posts_mins: "How many minutes before a user can make a post with the same content again"
educate_until_posts: "When the user starts typing their first (n) new posts, show the pop-up new user education panel in the composer." educate_until_posts: "When the user starts typing their first (n) new posts, show the pop-up new user education panel in the composer."

View File

@ -394,7 +394,6 @@ posting:
client: true client: true
default: true default: true
refresh: true refresh: true
uncategorized_description: "Topics that don't need a category, or don't fit into any other existing category."
allow_duplicate_topic_titles: false allow_duplicate_topic_titles: false
min_title_similar_length: min_title_similar_length:
client: true client: true

View File

@ -0,0 +1,11 @@
class MigrateUncategorizedDescriptionSetting < ActiveRecord::Migration
def change
execute "INSERT INTO translation_overrides (locale, translation_key, value, created_at, updated_at)
SELECT '#{I18n.locale}', 'category.uncategorized_description', value, created_at, updated_at
FROM site_settings
WHERE name = 'uncategorized_description'
AND value <> 'Topics that don''t need a category, or don''t fit into any other existing category.'"
execute "DELETE FROM site_settings WHERE name = 'uncategorized_description'"
end
end