i18n and translate page number text too

This commit is contained in:
wvengen 2013-05-20 17:14:42 +02:00
parent 3b7cbf71e0
commit d0c74b394e
3 changed files with 10 additions and 2 deletions

View file

@ -304,6 +304,10 @@ de:
tasks: tasks:
required_users: 'Es fehlen %{count} Mitstreiterinnen!' required_users: 'Es fehlen %{count} Mitstreiterinnen!'
lib:
order_pdf:
page: 'Seite %{number}'
# general user-interface # general user-interface
ui: ui:
close: 'Schließen' close: 'Schließen'

View file

@ -304,6 +304,10 @@ en:
tasks: tasks:
required_users: '%{count} members are still needed!' required_users: '%{count} members are still needed!'
lib:
order_pdf:
page: 'Page %{number}'
# general user-interface # general user-interface
ui: ui:
close: 'Close' close: 'Close'

View file

@ -17,7 +17,7 @@ class OrderPdf < Prawn::Document
# Define header # Define header
repeat :all, dynamic: true do repeat :all, dynamic: true do
draw_text title, size: 10, style: :bold, at: [bounds.left, bounds.top+20] if title # Header draw_text title, size: 10, style: :bold, at: [bounds.left, bounds.top+20] if title # Header
draw_text "Seite #{page_number}", size: 8, at: [bounds.left, bounds.bottom-10] # Footer draw_text I18n.t('lib.order_pdf.page', :number => page_number), size: 8, at: [bounds.left, bounds.bottom-10] # Footer
end end
body # Add content, which is defined in subclasses body # Add content, which is defined in subclasses
@ -29,4 +29,4 @@ class OrderPdf < Prawn::Document
def save_tmp def save_tmp
File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.pdf", 'w') {|f| f.write(to_pdf.force_encoding("UTF-8")) } File.open("#{Rails.root}/tmp/#{self.class.to_s.underscore}.pdf", 'w') {|f| f.write(to_pdf.force_encoding("UTF-8")) }
end end
end end