Add Spanish locale support and Euro-formatted invoice output - #1
Merged
Merged
Conversation
Co-authored-by: hugoarbones <32848906+hugoarbones@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
hugoarbones
September 1, 2026 09:35
View session
hugoarbones
marked this pull request as ready for review
September 1, 2026 09:36
There was a problem hiding this comment.
🟡 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=esandcurrency_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 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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) withEURvalues rendered using Spanish numeric/currency conventions.Localization
InvoiceGenerator/locale/es/LC_MESSAGES/messages.poand compiledmessages.mo.Currency/locale behavior coverage
30.150,00 €)Documentation
README.rstwith a minimal Spanish + Euro configuration example.