Skip to content

feat(i18n): Migrate to PO/MO translation system with French support#91

Open
bvisible wants to merge 6 commits intoBrainWise-DEV:developfrom
bvisible:develop
Open

feat(i18n): Migrate to PO/MO translation system with French support#91
bvisible wants to merge 6 commits intoBrainWise-DEV:developfrom
bvisible:develop

Conversation

@bvisible
Copy link

Summary

This PR modernizes the internationalization (i18n) system by migrating from CSV to the industry-standard PO/MO format and adds complete French language support.

Key Changes

  • PO/MO Translation System: Migrate from CSV to PO/MO format for better tooling support
  • French Language: Add complete French translations (4900+ strings)
  • Dynamic Language Detection: Auto-detect available languages from .po files
  • Font Rendering Fix: Resolve special character display issues (e.g., "ê" in Português)

Features

1. PO/MO Translation Migration

  • New translation files: ar.po, fr.po, pt_br.po
  • Template file: main.pot for translators
  • Removed deprecated CSV files
  • Added migration script and documentation

2. Dynamic Language Configuration

  • get_supported_locales() automatically scans .po files in locale directory
  • When allowed_locales is empty in POS Settings, all available languages are shown
  • No code changes needed when adding new languages

3. French Language Support

  • Complete translation of all 4900+ strings
  • Verified translation quality and variable preservation

4. Font Stack Fix

  • Reordered font-family: Inter before SaudiRiyalSymbol
  • Fixes rendering of accented characters (ê, é, à, etc.)

Files Changed

Category Files
Backend API pos_next/api/localization.py
Frontend POS/src/composables/useLocale.js, POS/src/index.css
Translations pos_next/locale/*.po, pos_next/locale/main.pot
Documentation docs/Translation-Migration-Guide.md, docs/LOCALIZATION.md
CI/CD .github/workflows/update-translations.yml
Scripts scripts/migrate_translations.py

How to Add New Languages

  1. Create a new .po file: pos_next/locale/{lang_code}.po
  2. Add the language config in POS/src/composables/useLocale.js:
new_lang: {
  name: "Language Name",
  nativeName: "Native Name",
  countryCode: "xx",
  dir: "ltr", // or "rtl"
}
  1. Translate the strings in the .po file
  2. Run bench build --app pos_next

Testing

  • Verified French translations display correctly
  • Tested language switching between all 4 languages
  • Confirmed special characters render properly
  • Validated dynamic language detection works

bvisible and others added 6 commits January 12, 2026 13:12
- Migrate from CSV to PO/MO (gettext) format for better tooling support
- Add complete French translation (1438 strings)
- Add French locale to SUPPORTED_LOCALES in useLocale.js
- Add migration script for CSV to PO conversion
- Add GitHub workflow for automatic POT file updates
- Update localization documentation
Auto-generated from source code changes
- Changed default behavior: empty allowed_locales now shows all supported languages
- Added get_supported_locales() to dynamically detect available languages from .po files
- Updated doctype description to reflect new behavior
Auto-generated from source code changes
Inter font must come before SaudiRiyalSymbol to properly render
accented characters like ê in Português
@bvisible
Copy link
Author

CI Failures Analysis

The 3 failing checks are pre-existing issues in the repository's CI configuration, not caused by this PR:

1. Server Build (❌)

ValueError: expected only letters, got ''
MO file created at .../pos_next.mo  ← Our translations compiled successfully

The error occurs during translation compilation of another app (not pos_next). Our French MO file was created successfully.

2. Frappe Linter (❌)

Pre-existing lint issues in the codebase:

  • # -*- coding: utf-8 -*- declarations (UP009)
  • from __future__ import unicode_literals (UP010)
  • Trailing whitespace in various files

These issues exist in files that were not modified by this PR.

3. Vulnerable Dependency Check (❌)

ERROR: No matching distribution found for erpnext

The CI tries to install erpnext from PyPI, but ERPNext is a Frappe app, not a PyPI package. This is a CI configuration issue.


Conclusion: All 3 failures are unrelated to the i18n changes in this PR. The CI configuration needs to be fixed independently.

@engahmed1190
Copy link
Contributor

Thank you, @bvisible, for your valuable contribution to the POSNext translations.
The implementation looks solid, and the quality is appreciated.
I will proceed with testing the changes across three additional languages.
Excellent work, and thank you for your effort and collaboration.

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