Skip to content

Add Spanish locale support and Euro-formatted invoice output - #1

Merged
hugoarbones merged 1 commit into
masterfrom
copilot/create-euros-and-spanish-support
Sep 1, 2026
Merged

Add Spanish locale support and Euro-formatted invoice output#1
hugoarbones merged 1 commit into
masterfrom
copilot/create-euros-and-spanish-support

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown

This change adds first-class Spanish invoice text localization and Euro formatting for Spanish locale output. It enables generating invoices in Spanish (INVOICE_LANG=es) with EUR values rendered using Spanish numeric/currency conventions.

  • Localization

    • Added a new Spanish gettext catalog at InvoiceGenerator/locale/es/LC_MESSAGES/messages.po and compiled messages.mo.
    • Covers invoice labels used in PDF output (e.g., totals, VAT breakdown, payment metadata, creator/date fields).
  • Currency/locale behavior coverage

    • Added PDF test coverage for Spanish + Euro configuration to validate rendered output text for:
      • Spanish section labels
      • Euro symbol placement/format
      • Spanish separators (e.g., 30.150,00 €)
  • Documentation

    • Updated README.rst with a minimal Spanish + Euro configuration example.
os.environ["INVOICE_LANG"] = "es"
invoice.currency_locale = "es_ES.UTF-8"
invoice.currency = "EUR"

Co-authored-by: hugoarbones <32848906+hugoarbones@users.noreply.github.com>
@hugoarbones
hugoarbones marked this pull request as ready for review September 1, 2026 09:36
Copilot AI lite review requested due to automatic review settings September 1, 2026 09:36
@hugoarbones
hugoarbones merged commit 98f559a into master Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new PDF test leaks global environment state and temporary files, which can cause cross-test interference and flaky/OS-dependent failures.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds Spanish invoice localization and validates Euro currency formatting for Spanish locale output, aligning generated PDF text with Spanish labels and numeric/currency conventions.

Changes:

  • Added a new Spanish gettext catalog (InvoiceGenerator/locale/es/LC_MESSAGES/messages.po) for invoice/PDF labels.
  • Added a PDF test asserting Spanish labels and Euro-formatted amounts when INVOICE_LANG=es and currency_locale=es_ES.UTF-8.
  • Updated README with a minimal Spanish + EUR configuration snippet.
File summaries
File Description
tests/test_pdf.py Adds coverage for Spanish-language PDF output with EUR formatting.
README.rst Documents Spanish + Euro configuration example.
InvoiceGenerator/locale/es/LC_MESSAGES/messages.po Introduces Spanish translations for invoice/PDF labels.
Review details
  • Files reviewed: 3/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_pdf.py
Comment on lines +166 to +187
def test_generate_with_euro_and_spanish(self):
os.environ["INVOICE_LANG"] = "es"
invoice = Invoice(Client('Kkkk'), Provider('Pupik'), Creator('blah'))
invoice.number = 'F20140001'
invoice.use_tax = True
invoice.add_item(Item(32, 600))
invoice.add_item(Item(60, 50, tax=10))
invoice.add_item(Item(50, 60, tax=5))
invoice.add_item(Item(5, 600, tax=50))
invoice.currency_locale = 'es_ES.UTF-8'
invoice.currency = 'EUR'

tmp_file = NamedTemporaryFile(delete=False)

pdf = SimpleInvoice(invoice)
pdf.gen(tmp_file.name)

pdf = PdfReader(tmp_file)
pdf_string = pdf.pages[0].extract_text()
self.assertTrue(u"30.150,00 €" in pdf_string)
self.assertTrue(u"Total con impuesto: 30.150,00 €" in pdf_string)
self.assertTrue(u"Creado por: blah" in pdf_string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants