From cccf92bfb67e3d680e4f459db3c32167503a20ef Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 13 Apr 2016 16:22:06 +0800 Subject: [PATCH] language fix --- app/controllers/personal_books_controller.rb | 2 +- app/models/book.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/personal_books_controller.rb b/app/controllers/personal_books_controller.rb index 762fea2..8b587be 100644 --- a/app/controllers/personal_books_controller.rb +++ b/app/controllers/personal_books_controller.rb @@ -42,7 +42,7 @@ class PersonalBooksController < ApplicationController when "author_type" t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} when "language" - t << {"value" => (I18n.t(book.language) if !book.language.nil? rescue "")} + t << {"value" => (I18n.t("personal_book.#{book.language}") if !book.language.nil? rescue "")} else t << {"value" => book.send(fs)} end diff --git a/app/models/book.rb b/app/models/book.rb index 9791b4d..24376ce 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -118,7 +118,7 @@ class Book when "author_type" pd_data << {"data_title" => (p.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} when "language" - pd_data << {"data_title" => (I18n.t(p.language) if !p.language.nil? rescue "")} + pd_data << {"data_title" => (I18n.t("personal_book.#{p.language}") if !p.language.nil? rescue "")} else pd_data << { "data_title" => p.send(t) } end @@ -164,7 +164,7 @@ class Book end value = value.join(" / ") when "language" - value = I18n.t(self.language) if !self.language.nil? rescue "" + value = I18n.t("personal_book.#{self.language}") if !self.language.nil? rescue "" when "publish_date", "publication_date" value = self.send(field).to_date.strftime("%Y-%m-%d") rescue nil when "file"