From af71f1ef349bffc7062bb93a17d4ae5ae548d5fe Mon Sep 17 00:00:00 2001 From: Yuki Date: Sat, 4 Jul 2015 13:01:46 +0530 Subject: [PATCH] =?UTF-8?q?Some=20adjustmenets=20to=20locale=20logic,=20ad?= =?UTF-8?q?d=20'jp.language:=20=E6=97=A5=E6=9C=AC=E8=AA=9E',=20regenerate?= =?UTF-8?q?=20schema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 13 +-- config/locales | 2 +- ...04072402_change_default_value_of_locale.rb | 5 + db/schema.rb | 103 ++++-------------- 4 files changed, 30 insertions(+), 93 deletions(-) create mode 100644 db/migrate/20150704072402_change_default_value_of_locale.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2ccca445..13d96e03 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -11,6 +11,8 @@ class ApplicationController < ActionController::Base def check_locale return I18n.locale = 'en' if Rails.env.test? + I18n.locale = 'en' + if params[:hl].nil? if current_user.present? I18n.locale = current_user.locale @@ -27,16 +29,7 @@ class ApplicationController < ActionController::Base end end - # Pirate English is not Puerto Rican English, you've doomed Puerto Rican English, Pixel. - if I18n.locale == 'en_pr' - I18n.locale = 'en_pirate' - if current_user.present? - current_user.locale = I18n.locale - current_user.save! - end - end - - cookies[:lang] = I18n.locale #unless cookies[:allow_cookies].nil? # some EU cookie bullsh- + cookies[:lang] = I18n.locale end # check if user got hit by the banhammer of doom diff --git a/config/locales b/config/locales index ec24b62d..3a7ced0a 160000 --- a/config/locales +++ b/config/locales @@ -1 +1 @@ -Subproject commit ec24b62d9c75a56d24191f61a0f6b1ce2e285596 +Subproject commit 3a7ced0a7e04b7bddd1c7c51ad1d35587739dae3 diff --git a/db/migrate/20150704072402_change_default_value_of_locale.rb b/db/migrate/20150704072402_change_default_value_of_locale.rb new file mode 100644 index 00000000..5ee208ff --- /dev/null +++ b/db/migrate/20150704072402_change_default_value_of_locale.rb @@ -0,0 +1,5 @@ +class ChangeDefaultValueOfLocale < ActiveRecord::Migration + def change + change_column :users, :locale, :string, :default => 'en' + end +end diff --git a/db/schema.rb b/db/schema.rb index 33b792fd..e89275fa 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150619123121) do +ActiveRecord::Schema.define(version: 20150704072402) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -19,12 +19,11 @@ ActiveRecord::Schema.define(version: 20150619123121) do create_table "answers", force: :cascade do |t| t.text "content" t.integer "question_id" - t.integer "comment_count", default: 0, null: false + t.integer "comment_count", default: 0, null: false t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "smile_count", default: 0, null: false - t.boolean "nsfw", default: false + t.integer "smile_count", default: 0, null: false end add_index "answers", ["user_id", "created_at"], name: "index_answers_on_user_id_and_created_at", using: :btree @@ -114,60 +113,6 @@ ActiveRecord::Schema.define(version: 20150619123121) do t.datetime "updated_at" end - create_table "oauth_access_grants", force: :cascade do |t| - t.integer "resource_owner_id", null: false - t.integer "application_id", null: false - t.string "token", null: false - t.integer "expires_in", null: false - t.text "redirect_uri", null: false - t.datetime "created_at", null: false - t.datetime "revoked_at" - t.string "scopes" - end - - add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree - - create_table "oauth_access_tokens", force: :cascade do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", null: false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.string "scopes" - end - - add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree - add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree - add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree - - create_table "oauth_applications", force: :cascade do |t| - t.string "name", null: false - t.string "uid", null: false - t.string "secret", null: false - t.text "redirect_uri", null: false - t.string "scopes", default: "", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.integer "owner_id" - t.string "owner_type" - t.string "description" - t.string "icon_file_name" - t.string "icon_content_type" - t.integer "icon_file_size" - t.datetime "icon_updated_at" - t.integer "crop_x" - t.integer "crop_y" - t.integer "crop_w" - t.integer "crop_h" - t.boolean "icon_processing" - end - - add_index "oauth_applications", ["name"], name: "index_oauth_applications_on_name", unique: true, using: :btree - add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree - add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree - create_table "questions", force: :cascade do |t| t.string "content" t.boolean "author_is_anonymous" @@ -176,8 +121,7 @@ ActiveRecord::Schema.define(version: 20150619123121) do t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "answer_count", default: 0, null: false - t.boolean "nsfw", default: false + t.integer "answer_count", default: 0, null: false end add_index "questions", ["user_id", "created_at"], name: "index_questions_on_user_id_and_created_at", using: :btree @@ -234,12 +178,12 @@ ActiveRecord::Schema.define(version: 20150619123121) do end create_table "users", force: :cascade do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" @@ -247,19 +191,19 @@ ActiveRecord::Schema.define(version: 20150619123121) do t.datetime "created_at" t.datetime "updated_at" t.string "screen_name" - t.integer "friend_count", default: 0, null: false - t.integer "follower_count", default: 0, null: false - t.integer "asked_count", default: 0, null: false - t.integer "answered_count", default: 0, null: false - t.integer "commented_count", default: 0, null: false + t.integer "friend_count", default: 0, null: false + t.integer "follower_count", default: 0, null: false + t.integer "asked_count", default: 0, null: false + t.integer "answered_count", default: 0, null: false + t.integer "commented_count", default: 0, null: false t.string "display_name" - t.integer "smiled_count", default: 0, null: false - t.boolean "admin", default: false, null: false - t.string "motivation_header", default: "", null: false - t.string "website", default: "", null: false - t.string "location", default: "", null: false - t.text "bio", default: "", null: false - t.boolean "moderator", default: false, null: false + t.integer "smiled_count", default: 0, null: false + t.boolean "admin", default: false, null: false + t.string "motivation_header", default: "", null: false + t.string "website", default: "", null: false + t.string "location", default: "", null: false + t.text "bio", default: "", null: false + t.boolean "moderator", default: false, null: false t.string "profile_picture_file_name" t.string "profile_picture_content_type" t.integer "profile_picture_file_size" @@ -276,13 +220,10 @@ ActiveRecord::Schema.define(version: 20150619123121) do t.boolean "privacy_show_in_search", default: true t.boolean "permanently_banned", default: false t.boolean "blogger", default: false - t.boolean "nsfw", default: false - t.boolean "show_nsfw", default: false - t.boolean "privacy_allow_nsfw_questions", default: true t.boolean "contributor", default: false t.string "ban_reason" t.datetime "banned_until" - t.integer "comment_smiled_count", default: 0, null: false + t.integer "comment_smiled_count", default: 0, null: false t.string "profile_header_file_name" t.string "profile_header_content_type" t.integer "profile_header_file_size" @@ -292,9 +233,7 @@ ActiveRecord::Schema.define(version: 20150619123121) do t.integer "crop_h_y" t.integer "crop_h_w" t.integer "crop_h_h" - t.string "socket_key", default: "" - t.datetime "socket_key_expiry", default: '0001-01-01 00:00:00' - t.string "locale" + t.string "locale", default: "en" t.boolean "translator", default: false end