diff --git a/frontend/index.html b/frontend/index.html index 753e134f180cfc087fb4583c2aa7093d00c7d598..a85b07de795e47d543a414a688d0957124321d98 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,5 +1,5 @@ - + diff --git a/frontend/src2/main.ts b/frontend/src2/main.ts index 3124595fd565267da37977893c4af9be9b556834..421ac2df70da67d1a75033e6d4305c0f73653d42 100644 --- a/frontend/src2/main.ts +++ b/frontend/src2/main.ts @@ -7,7 +7,7 @@ import App from './App.vue' import { registerControllers, registerGlobalComponents } from './globals.ts' import './index.css' import router from './router.ts' -import { translationPlugin } from './translation.ts' +import { loadTranslations, translationPlugin } from './translation.ts' import { telemetryPlugin } from 'frappe-ui/frappe' import session from './session.ts' @@ -45,5 +45,14 @@ app.config.errorHandler = (err, vm, info) => { registerGlobalComponents(app) registerControllers(app) -app.mount('#app') -app.use(translationPlugin); +app.use(translationPlugin) + +async function mountApp() { + try { + await loadTranslations() + } finally { + app.mount('#app') + } +} + +mountApp() diff --git a/frontend/src2/translation.ts b/frontend/src2/translation.ts index 450487bab3dc438c34ff5f7cccfd22207185fcb5..23cca7797ad97a830a1e1e56c19e9acbeb51dbac 100644 --- a/frontend/src2/translation.ts +++ b/frontend/src2/translation.ts @@ -1,4 +1,4 @@ -import { createResource } from "frappe-ui"; +import { frappeRequest } from "frappe-ui"; import type { App } from "vue"; function getTranslatedMessage(message: string): string { @@ -20,25 +20,18 @@ function translate(message: string, ...args: string[]): string { export const __ = translate; -function fetchTranslations() { - createResource({ +export async function loadTranslations() { + const data = await frappeRequest({ url: "insights.api.translations.get_translations", method: "GET", - cache: "translations", - auto: true, - transform(data: Record) { - (window as any).translatedMessages = data; - } }); + (window as any).translatedMessages = data; } export function translationPlugin(app: App) { app.config.globalProperties.__ = translate; const windowObj = window as any; windowObj.__ = translate; - if (!windowObj.translatedMessages) { - fetchTranslations(); - } } declare module '@vue/runtime-core' { diff --git a/insights/hooks.py b/insights/hooks.py index 146a2d476ff8dff03babd009f65a89e846287e3a..7e8a649babd050bb18735dc3d77b2c3d6ac52da9 100644 --- a/insights/hooks.py +++ b/insights/hooks.py @@ -41,7 +41,9 @@ insights_workbooks = "workbook_templates" # include js, css files in header of desk.html # app_include_css = "/assets/insights/css/insights.css" -app_include_js = "insights_nudge.bundle.js" +# The Full Reference composition publishes this source-owned script directly; +# no stale global asset manifest entry is required. +app_include_js = "/assets/insights/js/insights_nudge.bundle.js" # include js, css files in header of web template # web_include_css = "/assets/insights/css/insights.css" diff --git a/insights/locale/ar.po b/insights/locale/ar.po index e9ce1d0cf39fe2ad6a6b6a9d4d3dc7c0d1564fe7..361b0f45eda55ffb3c1cc64f9674a00a33adf7dd 100644 --- a/insights/locale/ar.po +++ b/insights/locale/ar.po @@ -774,7 +774,7 @@ msgstr "مصدر البيانات" #: frontend/src2/data_source/DataSourceTable.vue:25 #: frontend/src2/data_source/DataSourceTableList.vue:65 msgid "Data Sources" -msgstr "" +msgstr "مصادر البيانات" #: frontend/src2/data_source/DataSourceList.vue:141 msgid "Data Sources | Insights" @@ -787,7 +787,7 @@ msgstr "" #: frontend/src2/settings/Settings.vue:43 #: insights/insights/doctype/insights_query_execution_log/insights_query_execution_log.json msgid "Data Store" -msgstr "" +msgstr "مخزن البيانات" #: frontend/src2/charts/components/NewMeasureSelectorDialog.vue:120 msgid "Data Type" @@ -1113,7 +1113,7 @@ msgstr "" #: frontend/src2/dashboard/DashboardList.vue:28 msgid "Favorites" -msgstr "" +msgstr "المفضلة" #: frontend/src2/query/components/QueryExecutionStatus.vue:18 #: frontend/src2/query/components/ScriptQueryEditor.vue:128 @@ -1952,7 +1952,7 @@ msgstr "" #: frontend/src2/data_source/DataSourceList.vue:120 msgid "Modified" -msgstr "" +msgstr "آخر تعديل" #. Option for the 'Week Starts On' (Select) field in DocType 'Insights #. Settings' @@ -2015,7 +2015,7 @@ msgstr "" #: frontend/src2/workbook/WorkbookList.vue:167 #: frontend/src2/workbook/WorkbookList.vue:202 msgid "New Workbook" -msgstr "" +msgstr "مصنف جديد" #. Label of the next_execution (Datetime) field in DocType 'Insights Alert' #: insights/insights/doctype/insights_alert/insights_alert.json @@ -2126,7 +2126,7 @@ msgstr "" #: frontend/src2/dashboard/DashboardList.vue:92 #: frontend/src2/dashboard/DashboardList.vue:97 msgid "Nothing here" -msgstr "" +msgstr "لا توجد بيانات هنا" #. Label of the old_name (Data) field in DocType 'Insights Chart v3' #. Label of the old_name (Data) field in DocType 'Insights Dashboard v3' @@ -2382,7 +2382,7 @@ msgstr "" #: frontend/src2/dashboard/DashboardList.vue:27 msgid "Recents" -msgstr "آخر الأخبار" +msgstr "الأحدث" #. Label of the recipients (Small Text) field in DocType 'Insights Alert' #: frontend/src2/query/components/AlertSetupDialog.vue:181 @@ -2627,7 +2627,7 @@ msgstr "" #: frontend/src2/dashboard/DashboardList.vue:159 #: frontend/src2/workbook/WorkbookList.vue:225 msgid "Search by title" -msgstr "" +msgstr "البحث بالعنوان" #: frontend/src2/workbook/WorkbookLineageDialog.vue:163 msgid "Search nodes\\u2026" @@ -2735,7 +2735,7 @@ msgstr "الإعداد كاملة" #: frontend/src2/components/DemoDataBanner.vue:64 msgid "Setup Demo Data" -msgstr "" +msgstr "إعداد بيانات تجريبية" #: frontend/src2/components/DemoDataBanner.vue:32 #: frontend/src2/settings/GeneralSettings.vue:28 @@ -3172,7 +3172,7 @@ msgstr "" #: frontend/src2/components/DemoDataBanner.vue:50 msgid "Try demo data" -msgstr "" +msgstr "تجربة البيانات التجريبية" #. Option for the 'Week Starts On' (Select) field in DocType 'Insights #. Settings' @@ -3387,7 +3387,15 @@ msgstr "" #: frontend/src2/home/HomeWorkbookList.vue:36 #: frontend/src2/workbook/WorkbookList.vue:37 msgid "Workbooks" -msgstr "" +msgstr "المصنفات" + +#: frontend/src2/home/HomeDashboardList.vue +msgid "No dashboards to display." +msgstr "لا توجد لوحات معلومات للعرض." + +#: frontend/src2/home/HomeLayout.vue +msgid "Explore with sample data and a pre-built workbook" +msgstr "استكشف بيانات نموذجية ومصنفًا جاهزًا" #: frontend/src2/charts/components/MapChartConfigForm.vue:54 msgid "World Map" @@ -3592,4 +3600,3 @@ msgstr "يبدأ ب" #: frontend/src2/query/components/ColumnsSelectorDialog.vue:120 msgid "{0} columns selected" msgstr "" - diff --git a/insights/www/_insights.py b/insights/www/_insights.py index 371c7ae10dadcca2028dc5ee6425c84cf7c37900..f427bc66cedcd9203929925eefa6e52432374a25 100644 --- a/insights/www/_insights.py +++ b/insights/www/_insights.py @@ -21,6 +21,7 @@ def get_context(context): frappe.db.commit() context.boot = { "csrf_token": csrf_token, + "lang": frappe.local.lang, "site_name": frappe.local.site, "is_fc_site": is_fc_site(), "socketio_port": frappe.conf.get("socketio_port"),