in Ruby

Building international invoices with InvoicePrinter 0.0.9

From the start I wanted an unobstructive and flexible API for InvoicePrinter. This flexibility enables anyone to make international duo-lingual invoices without any special i18n API provided. But the truth is I had something a bit better in mind from the beginning and in 0.0.9 I am including something new suited for the job.

I am introducing a thing called sublabels. Every label you pass to InvoicePrinter now can have a sublabel too:

labels = {
  purchaser: 'Customer',
  ...
  sublabels: {
    purchaser: 'Kunde'
  }
}

InvoicePrinter.print(
  document: invoice,
  labels: labels,
  file_name: 'invoice.pdf'
)

They are called sublabels, because I want them to stay very simple, not tied with a translation strings or anything. What they do is they place an additional string next to the label itself (under it or next to it depending on the label). That means it can really be anything you need. It can be a translation of the label or a little note. The position or looks may change, but it’s important to have an API supporting it. So from now on for any label you can provide a sublabel. Also sublabel is only shown if you are including the label itself.

You can see the new feature on a new example – international invoice that provides English labels to a Czech invoice.

I released InvoicePrinter 0.0.9 last week so try it out and let me know what you think!

Write a Comment

Comment