Skip to content

Add full translation support to the crm_dashboard module and localize all user-facing strings so the dashboard respects the user's language.#423

Open
maurorosero wants to merge 5 commits into
CybroOdoo:19.0from
maurorosero:19.0-crm_dashboard-i18n
Open

Add full translation support to the crm_dashboard module and localize all user-facing strings so the dashboard respects the user's language.#423
maurorosero wants to merge 5 commits into
CybroOdoo:19.0from
maurorosero:19.0-crm_dashboard-i18n

Conversation

@maurorosero

Copy link
Copy Markdown

Changes

Model (models/crm_lead.py)

  • Render month names via babel.dates using the user's language instead of hardcoded English (calendar.month_name) or DB-locale-dependent TO_CHAR.
  • Read mail_activity_type.name (a translate=True JSONB field) from the user's lang with fallback to en_US, instead of forcing en_US.
  • Wrap revenue pie labels (Expected without Won, Won, Lost) with _() for translation.
  • Group the lost-leads query by month number (locale-independent) and label months on the Python side to keep ordering stable across database locales.

JavaScript (static/src/js/crm_dashboard.js)

  • Import _t from @web/core/l10n/translation.
  • Pre-translate all visible UI strings (titles, period labels, chart legends, action window names) into a state.texts map so they can be consumed from the QWeb template, which has no _t in its context.
  • Wrap action.doAction name and Chart.js label strings with _t().

QWeb template (static/src/xml/dashboard_templates.xml)

  • Replace all hardcoded English text with state.texts.* lookups so the rendered UI follows the current user's language.

Manifest

  • Bump version 19.0.1.0.019.0.1.0.1.

i18n

  • Add initial .po files for: en, es, es_419, es_AR, es_CL, es_CO, es_MX, es_PA, es_PE, es_VE, pt, pt_BR, pt_PT.

…model

- Use babel.dates to render month names in the user's language instead of
  hardcoded English via calendar.month_name / TO_CHAR.
- Read mail_activity_type.name from the user's lang (translate=True field)
  with fallback to en_US instead of forcing 'en_US'.
- Wrap 'Expected without Won', 'Won', 'Lost' with _() for translation.
- Group lost-leads query by month number (locale-independent) and label
  months on the Python side to keep ordering stable across DB locales.
- Import _t from @web/core/l10n/translation.
- Pre-translate all visible UI strings (titles, period labels, chart
  legends, action names) into a state.texts map so they can be looked
  up from the QWeb template, which has no _t in its context.
- Wrap action.doAction 'name' and Chart.js 'label' strings with _t().
…le strings

Replace all hardcoded English text in dashboard_templates.xml with
state.texts.* lookups, which are pre-translated in crm_dashboard.js
via _t(). This allows the dashboard UI to be translated per-user.
Minor version bump for translation/i18n improvements.
Add .po files for English (en), Spanish variants (es, es_419, es_AR,
es_CL, es_CO, es_MX, es_PA, es_PE, es_VE) and Portuguese variants
(pt, pt_BR, pt_PT).
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.

1 participant