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"
@ -24,7 +24,6 @@ ActiveRecord::Schema.define(version: 20150619123121) do
t.datetime "created_at"
t.datetime "updated_at"
t.integer "smile_count", default: 0, null: false
t.boolean "nsfw", default: 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"
@ -177,7 +122,6 @@ ActiveRecord::Schema.define(version: 20150619123121) do
t.datetime "created_at"
t.datetime "updated_at"
t.integer "answer_count", default: 0, null: false
t.boolean "nsfw", default: false
end
add_index "questions", ["user_id", "created_at"], name: "index_questions_on_user_id_and_created_at", using: :btree
@ -276,9 +220,6 @@ 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"
@ -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