diff --git a/app/documents/order_by_articles.rb b/app/documents/order_by_articles.rb index 292cc370..705393f5 100644 --- a/app/documents/order_by_articles.rb +++ b/app/documents/order_by_articles.rb @@ -2,11 +2,12 @@ class OrderByArticles < OrderPdf def filename - "Bestellung #{@order.name}-#{@order.ends.to_date} - Artikelsortierung.pdf" + I18n.t('documents.order_by_articles.filename', :name => @order.name, :date => @order.ends.to_date) + '.pdf' end def title - "Artikelsortierung der Bestellung: #{@order.name}, beendet am #{@order.ends.strftime('%d.%m.%Y')}" + I18n.t('documents.order_by_articles.title', :name => @order.name, + :date => @order.ends.strftime(I18n.t('date.formats.default'))) end def body @@ -14,7 +15,7 @@ class OrderByArticles < OrderPdf text "#{order_article.article.name} (#{order_article.article.unit} | #{order_article.price.unit_quantity.to_s} | #{number_with_precision(order_article.price.fc_price, precision: 2)})", style: :bold, size: 10 rows = [] - rows << %w(Bestellgruppe Menge Preis) + rows << I18n.t('documents.order_by_articles.rows') for goa in order_article.group_order_articles rows << [goa.group_order.ordergroup.name, goa.result, @@ -30,4 +31,4 @@ class OrderByArticles < OrderPdf end end -end \ No newline at end of file +end diff --git a/app/documents/order_by_groups.rb b/app/documents/order_by_groups.rb index 74c6ffe6..5ee66cca 100644 --- a/app/documents/order_by_groups.rb +++ b/app/documents/order_by_groups.rb @@ -2,11 +2,12 @@ class OrderByGroups < OrderPdf def filename - "Bestellung #{@order.name}-#{@order.ends.to_date} - Gruppensortierung.pdf" + I18n.t('documents.order_by_groups.filename', :name => @order.name, :date => @order.ends.to_date) + '.pdf' end def title - "Gruppensortierung der Bestellung: #{@order.name}, beendet am #{@order.ends.strftime('%d.%m.%Y')}" + I18n.t('documents.order_by_groups.title', :name => @order.name, + :date => @order.ends.strftime(I18n.t('date.formats.default'))) end def body @@ -16,7 +17,7 @@ class OrderByGroups < OrderPdf total = 0 rows = [] - rows << %w(Artikel Menge Preis GebGr Einheit Summe) # Table Header + rows << I18n.t('documents.order_by_groups.rows') # Table Header group_order_articles = group_order.group_order_articles.ordered group_order_articles.each do |goa| @@ -30,7 +31,7 @@ class OrderByGroups < OrderPdf goa.order_article.article.unit, number_with_precision(sub_total, precision: 2)] end - rows << [ "Summe", nil, nil, nil, nil, number_with_precision(total, precision: 2)] + rows << [ I18n.t('documents.order_by_groups.sum'), nil, nil, nil, nil, number_with_precision(total, precision: 2)] table rows, column_widths: [250,50,50,50,50,50], cell_style: {size: 8, overflow: :shrink_to_fit} do |table| # borders @@ -48,4 +49,4 @@ class OrderByGroups < OrderPdf end end -end \ No newline at end of file +end diff --git a/app/documents/order_fax.rb b/app/documents/order_fax.rb index 84ef70d6..cc86c94a 100644 --- a/app/documents/order_fax.rb +++ b/app/documents/order_fax.rb @@ -2,7 +2,7 @@ class OrderFax < OrderPdf def filename - "Bestellung #{@order.name}-#{@order.ends.to_date} - Fax.pdf" + I18n.t('documents.order_fax.filename', :name => @order.name, :date => @order.ends.to_date) + '.pdf' end def title @@ -20,11 +20,11 @@ class OrderFax < OrderPdf move_down 5 text "#{contact[:zip_code]} #{contact[:city]}", size: 9, align: :right move_down 5 - text "Kundennummer: #{@order.supplier.try(:customer_number)}", size: 9, align: :right + text "#{I18n.t('simple_form.labels.supplier.customer_number')}: #{@order.supplier.try(:customer_number)}", size: 9, align: :right move_down 5 - text "Telefon: #{contact[:phone]}", size: 9, align: :right + text "#{I18n.t('simple_form.labels.supplier.phone')}: #{contact[:phone]}", size: 9, align: :right move_down 5 - text "E-mail: #{contact[:email]}", size: 9, align: :right + text "#{I18n.t('simple_form.labels.supplier.email')}: #{contact[:email]}", size: 9, align: :right end # Recipient @@ -33,20 +33,20 @@ class OrderFax < OrderPdf move_down 5 text @order.supplier.try(:address).to_s move_down 5 - text "Fax: #{@order.supplier.try(:fax)}" + text "#{I18n.t('simple_form.labels.supplier.fax')}: #{@order.supplier.try(:fax)}" end move_down 5 - text Date.today.strftime('%d.%m.%Y'), align: :right + text Date.today.strftime(I18n.t('date.formats.default')), align: :right move_down 10 - text "Lieferdatum:" + text "#{I18n.t('simple_form.labels.delivery.delivered_on')}:" move_down 10 - text "Ansprechpartner: #{@order.supplier.try(:contact_person)}" + text "#{I18n.t('simple_form.labels.supplier.contact_person')}: #{@order.supplier.try(:contact_person)}" move_down 10 # Articles - data = [["BestellNr.", "Menge","Name", "Gebinde", "Einheit","Preis/Einheit"]] + data = [I18n.t('documents.order_fax.rows')] data = @order.order_articles.ordered.all(include: :article).collect do |a| [a.article.order_number, a.units_to_order, diff --git a/app/documents/order_matrix.rb b/app/documents/order_matrix.rb index a83bedab..f43d490b 100644 --- a/app/documents/order_matrix.rb +++ b/app/documents/order_matrix.rb @@ -4,22 +4,23 @@ class OrderMatrix < OrderPdf MAX_ARTICLES_PER_PAGE = 16 # How many order_articles shoud written on a page def filename - "Bestellung #{@order.name}-#{@order.ends.to_date} - Sortiermatrix.pdf" + I18n.t('documents.order_matrix.filename', :name => @order.name, :date => @order.ends.to_date) + '.pdf' end def title - "Sortiermatrix der Bestellung: #{@order.name}, beendet am #{@order.ends.strftime('%d.%m.%Y')}" + I18n.t('documents.order_matrix.title', :name => @order.name, + :date => @order.ends.strftime(I18n.t('date.formats.default'))) end def body order_articles = @order.order_articles.ordered - text "Artikelübersicht", style: :bold + text I18n.t('documents.order_matrix.heading'), style: :bold move_down 5 - text "Insgesamt #{order_articles.size} Artikel", size: 8 + text I18n.t('documents.order_matrix.total', :count => order_articles.size), size: 8 move_down 10 - order_articles_data = [%w(Artikel Einheit Gebinde FC-Preis Menge)] + order_articles_data = [I18n.t('documents.order_matrix.rows')] order_articles.each do |a| order_articles_data << [a.article.name, @@ -83,4 +84,4 @@ class OrderMatrix < OrderPdf end end -end \ No newline at end of file +end diff --git a/config/locales/de/de.documents.yml b/config/locales/de/de.documents.yml new file mode 100644 index 00000000..cff7bb51 --- /dev/null +++ b/config/locales/de/de.documents.yml @@ -0,0 +1,41 @@ +de: + # for app/documents + documents: + order_by_articles: + filename: 'Bestellung %{name}-%{date} - Artikelsortierung' + title: 'Artikelsortierung der Bestellung: %{name}, beendet am %{date}' + rows: + - Bestellgruppe + - Menge + - Preis + order_by_groups: + filename: 'Bestellung %{name}-%{date} - Gruppensortierung' + title: 'Gruppensortierung der Bestellung: %{name}, beendet am %{date}' + rows: + - Artikel + - Menge + - Preis + - GebGr + - Einheit + - Summe + sum: 'Summe' + order_fax: + filename: 'Bestellung %{name}-%{date} - Fax' + rows: + - BestellNr. + - Menge + - Name + - Gebinde + - Einheit + - Preis/Einheit + order_matrix: + filename: 'Bestellung %{name}-%{date} - Sortiermatrix' + title: 'Sortiermatrix der Bestellung: %{name}, beendet am %{date}' + heading: 'Artikelübersicht' + total: 'Insgesamt %{count} Artikel' + rows: + - Artikel + - Einheit + - Gebinde + - FC-Preis + - Menge