Skip to content

Enable localization and add empty Spanish po file #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: v0.7.10
Choose a base branch
from

Conversation

ChayoteJarocho
Copy link

Contributes to #248

This change enables localization via the modification of LANGUAGE_CODE (found in settings.py, line 93). In other words, this change only enables the hardcoded type of localization, not the kind that the user would select from a dropdown in the website (that requires adding middleware, urls, and adding the dropdown somewhere in a template).

I tested this change by setting LANGUAGE_CODE to es and also to es-mx, generating the corresponding *.po files for each, then making a few quick translations, compiling the *.po file into *.mo file, and verifying that the translations show up (and they do).

I am including the default (not-yet translated) file for Spanish, which in a follow-up PR I will translate as much as I can.

elarroba and others added 3 commits July 31, 2025 13:36
* v.0.7.7

* Enhance account list views and update icon styles.

Implemented dynamic page titles and subtitles for account pages by overriding `get_context_data`. Updated template text and classes for greater consistency, including standardizing icon colors for active, locked, and default roles.

* Adding TransactionModel attributes during commit_txs.

* Fixed a couple of hard coded dollar "$" symbols and changed them with `{% currency_symbol %}` tag to render the correct symbol when `DJANGO_LEDGER_CURRENCY_SYMBOL` is other than default ("$"). (arrobalytics#265)

* Dependency update

* Update contribution guidelines in README and Contribute.md

Clarified the types of pull requests that are encouraged, emphasizing those that address bug fixes, enhancements, or valuable additions. Added a note discouraging submissions focused only on cosmetic changes like linting or refactoring.

* Update ManyToManyField configurations and bump version to 0.7.8

Adjusted `ManyToManyField` relationships in `BillModel`, `InvoiceModel`, and `PurchaseOrderModel` to include `through` and `through_fields` for `ItemTransactionModel`. Incremented package version to `0.7.8`.

* Add support for bank account type validation and retrieval based on OFX standards

- Introduced `bank_account_type` field in `BankAccountModel` with predefined choices.
- Added methods to retrieve routing number, account type, and account type validation in `OFXImport` class.
- Enhanced account queries with a new `.cash()` method to filter accounts with `ASSET_CA_CASH` role.
- Updated indexing and unique constraints for `BankAccountModel`.

* Migration Update

* Refactor bank account type handling and account type mapping logic

- Replaced `BankAccountModel.BANK_ACCOUNT_TYPES` with explicit OFX types.
- Renamed `ACCOUNT_TYPE_ROLE_MAPPING` to `ACCOUNT_TYPE_DEFAULT_ROLE_MAPPING`.
- Centralized OFX type mappings in `ACCOUNT_TYPE_OFX_MAPPING`.
- Removed `bank_account_type` field from `BankAccountModel`.
- Added `get_account_type_from_ofx` method for retrieving account type from OFX data.

* Add financial institution field and utility methods to account models

- Introduced `financial_institution` field in account mixin for storing bank details.
- Added `get_account_last_digits` utility for partial account number retrieval.
- Implemented `can_hide` and `can_unhide` methods in `BankAccountModel`.

* Refactor account handling and enhance validation methods

- Renamed `get_account_type` to `get_ofx_account_type` for clarity in OFX implementation.
- Added `get_account_type` method to map OFX account types to internal account types.
- Introduced `get_routing_last_digits` method for masked routing number retrieval.
- Improved handling of missing account and routing numbers in utility methods.

* Sort node issue fix

* Update chart_of_accounts.py

* Bump version to 0.7.9 and update `for_entity` method to accept `EntityModel` instances.

---------

Co-authored-by: Pablo Santa Cruz <[email protected]>
Co-authored-by: killinstreak <[email protected]>
Co-authored-by: Shucon Tech <[email protected]>
@ChayoteJarocho ChayoteJarocho mentioned this pull request Aug 12, 2025
@ChayoteJarocho
Copy link
Author

I should also edit the documentation to provide instructions to generate a new *.po file.

@elarroba do you have any location preference for this info? Maybe a specific section of the main README file?

@ChayoteJarocho
Copy link
Author

ChayoteJarocho commented Aug 13, 2025

I added a section in the main README. Please let me know if you like it or if you would prefer it somewhere else.

I also decided to add the Spanish translations to this same PR so that you can test them. Not ready yet. I found some formatting errors.

In future iterations, the selected language could be picked up from the user's HTTP headers. For now, the option is to hardcode it using LANGUAGE_CODE in settings.py, it's the simplest and most direct way of getting translations.

@elarroba elarroba self-assigned this Aug 14, 2025
@elarroba elarroba changed the base branch from master to v0.7.10 August 14, 2025 18:14
@ChayoteJarocho
Copy link
Author

I want to avoid making this PR gigantic. Do you mind if we get this PR reviewed (and hopefully merged) first? I can then submit a separate PR with these changes in this branch, which are the actual Spanish translations as well as missing _('') calls and some minor bug fixes related to translation: https://github.com/ChayoteJarocho/django-ledger/tree/Translations

…nction so it is made available in AppCharts.ts. Include README instructions for the generation of javascript translations.
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.

2 participants