Skip to content

Commit

Permalink
Use translations
Browse files Browse the repository at this point in the history
  • Loading branch information
giladshanan committed Jun 10, 2024
1 parent db2fe7b commit bd5a854
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion app/support/example_statement_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class ExampleStatementPdf < StatementPdf

include TextHelpers::Translation

def generate(pdf)
generate_document_header(pdf)
generate_contact_info(pdf) if @facility.has_contact_info?
Expand Down Expand Up @@ -35,7 +37,8 @@ def generate_document_header(pdf)
pdf.text "Account: #{@account}"
pdf.text "Owner: #{@account.owner_user.full_name(suspended_label: false)}"
pdf.move_down(10)
pdf.text "Items on this statement may have been placed on your behalf by another core facility.", style: :italic if @statement.display_cross_core_messsage?
cross_core_message = text("cross_core_message")
pdf.text cross_core_message, style: :italic if @statement.display_cross_core_messsage?
pdf.move_down(10)
end

Expand Down Expand Up @@ -72,4 +75,8 @@ def order_detail_rows
end
end

def translation_scope
"statement_pdf"
end

end
3 changes: 3 additions & 0 deletions config/locales/services/en.statement_pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
en:
statement_pdf:
cross_core_message: "Items on this !statement_downcase! may have been placed on your behalf by another !facility_downcase!."
4 changes: 2 additions & 2 deletions spec/support/contexts/cross_core_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
let(:cross_core_project2) { create(:project, facility: facility2, name: "#{facility2.abbreviation}-2") }
let(:cross_core_project3) { create(:project, facility: facility3, name: "#{facility3.abbreviation}-3") }

# Create the cross core orders and add them to the relevant projcects
# Create the cross core orders and add them to the relevant projects
let!(:cross_core_orders) do
[
create(:purchased_order, cross_core_project:, product: facility2_item, account: accounts.last),
Expand All @@ -39,5 +39,5 @@
create(:purchased_order, cross_core_project: cross_core_project3, product: facility2_item2, account: accounts.last),
]
end

end

0 comments on commit bd5a854

Please sign in to comment.