Some adjustmenets to locale logic, add 'jp.language: 日本語', regenerate schema

This commit is contained in:
Yuki 2015-07-04 13:01:46 +05:30
parent bbecf20c52
commit af71f1ef34
4 changed files with 30 additions and 93 deletions

View File

@ -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

@ -1 +1 @@
Subproject commit ec24b62d9c75a56d24191f61a0f6b1ce2e285596
Subproject commit 3a7ced0a7e04b7bddd1c7c51ad1d35587739dae3

View File

@ -0,0 +1,5 @@
class ChangeDefaultValueOfLocale < ActiveRecord::Migration
def change
change_column :users, :locale, :string, :default => 'en'
end
end

View File

@ -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