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

View File

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