language fix

This commit is contained in:
Harry Bomrah 2016-04-13 16:22:06 +08:00
parent 0ba5fea219
commit cccf92bfb6
2 changed files with 3 additions and 3 deletions

View File

@ -42,7 +42,7 @@ class PersonalBooksController < ApplicationController
when "author_type" when "author_type"
t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} t << {"value" => (book.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")}
when "language" 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 else
t << {"value" => book.send(fs)} t << {"value" => book.send(fs)}
end end

View File

@ -118,7 +118,7 @@ class Book
when "author_type" when "author_type"
pd_data << {"data_title" => (p.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")} pd_data << {"data_title" => (p.book_author_types.collect{|bat| bat.title}.join(", ") rescue "")}
when "language" 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 else
pd_data << { "data_title" => p.send(t) } pd_data << { "data_title" => p.send(t) }
end end
@ -164,7 +164,7 @@ class Book
end end
value = value.join(" / ") value = value.join(" / ")
when "language" 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" when "publish_date", "publication_date"
value = self.send(field).to_date.strftime("%Y-%m-%d") rescue nil value = self.send(field).to_date.strftime("%Y-%m-%d") rescue nil
when "file" when "file"