opened 06:38AM - 02 Mar 26 UTC
feature request
How can I make the translation work? I tried adding the translation file to zh.c…sv, but it didn't work.
Subject: Frappe Insights translation mechanism inconsistent with Frappe Core standards
Issue Summary
The translation mechanism in Frappe Insights does not follow the standard Frappe translation workflow. Translations added via a custom app's zh.csv or through the system's Translation List (the tabTranslation table) are ignored by the Insights UI, while they work perfectly for other Frappe-based apps (e.g., Knowledge Base, ERPNext modules).
Technical Analysis
Based on my investigation, the root causes appear to be:
Decoupled SPA Architecture: Since Insights is a Vue.js-based Single Page Application (SPA), it does not fully utilize the standard Frappe _() translation function during runtime. The UI rendering happens on the client side, but it fails to fetch or merge global translation records from the database.
Hardcoded Asset Bundling: Most UI strings seem to be bundled into the static JS files during the bench build process. Insights only looks at its own locales/*.json files within the apps/insights/ directory, ignoring translation injections from other installed apps.
Missing Translation Merging: The API used by Insights to load languages does not seem to aggregate translations from the global frappe.translate.get_dict. This prevents administrators from overriding or adding translations through the standard UI tools.
Steps to Reproduce
Install a custom app with a zh.csv containing translations for Insights-specific strings.
Alternatively, add a new record in the Translation List (Desk UI) for an Insights UI string (e.g., "Dashboards" -> "仪表盘").
Refresh the Insights dashboard.
Result: The UI remains in English, while other Frappe modules correctly reflect the new translation.
Proposed Solution
Align Frontend Translation: Modify the Insights frontend initialization to fetch and merge global translations from the Frappe Core translation API.
Support Dynamic Overrides: Ensure the Vue.js i18n implementation respects the tabTranslation table in the database.
Standardize Scraping: Ensure Insights' .vue and .js files are compatible with bench get-untranslated so that community translations can be easily contributed and maintained via standard .csv files.
💡 给官方的小贴士 (Additional Note for the Team):
"We expect a unified experience across the Frappe ecosystem. Having to manually modify the core files of the Insights app to achieve localization makes maintenance and updates extremely difficult for non-English speaking users."