diff --git a/src/workbench/browser/src/app/core/services/electron/electron.service.ts b/src/workbench/browser/src/app/core/services/electron/electron.service.ts index 1bf4546c4..82275edba 100644 --- a/src/workbench/browser/src/app/core/services/electron/electron.service.ts +++ b/src/workbench/browser/src/app/core/services/electron/electron.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; // If you import a module but never use any of the imported values other than as TypeScript types, // the resulting javascript file will look as if you never imported the module at all. import { getSettings } from 'eo/workbench/browser/src/app/modules/system-setting/settings.service'; +import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service'; import { getBrowserType } from 'eo/workbench/browser/src/app/utils/browser-type'; import StorageUtil from 'eo/workbench/browser/src/app/utils/storage/storage.utils'; @@ -18,7 +19,7 @@ type DescriptionsItem = { }) export class ElectronService { ipcRenderer; - constructor(private store: StoreService) { + constructor(private store: StoreService, private trace: TraceService) { // Conditional imports if (this.isElectron) { // Notes : @@ -33,6 +34,7 @@ export class ElectronService { // https://www.electronjs.org/docs/latest/api/ipc-renderer#ipcrendererinvokechannel-args this.ipcRenderer = window.electron.ipcRenderer; } + this.trace.setUser({ client_type: this.isElectron ? 'client' : 'web' }); } get isElectron(): boolean { diff --git a/src/workbench/browser/src/app/core/services/language/language.service.ts b/src/workbench/browser/src/app/core/services/language/language.service.ts index 7a0a45b50..8994943bd 100644 --- a/src/workbench/browser/src/app/core/services/language/language.service.ts +++ b/src/workbench/browser/src/app/core/services/language/language.service.ts @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core'; import { ElectronService } from 'eo/workbench/browser/src/app/core/services/electron/electron.service'; import { LANGUAGES } from 'eo/workbench/browser/src/app/core/services/language/language.model'; import { SettingService } from 'eo/workbench/browser/src/app/modules/system-setting/settings.service'; +import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service'; import { APP_CONFIG } from 'eo/workbench/browser/src/environments/environment'; @Injectable({ @@ -13,12 +14,13 @@ export class LanguageService { // Web from nginx setting and App from computer system setting systemLanguage; langHashMap = new Map().set('zh-Hans', 'zh').set('en-US', 'en'); - constructor(private electron: ElectronService, private setting: SettingService) { + constructor(private electron: ElectronService, private setting: SettingService, private trace: TraceService) { //Curent language this.systemLanguage = this.languages.find(val => window.location.pathname.includes(`/${val.path}/`))?.value || this.setting.settings?.['system.language'] || (navigator.language.includes('zh') ? 'zh-Hans' : 'en-US'); + this.trace.setUser({ app_language: this.systemLanguage }); } get langHash() { return this.langHashMap.get(this.systemLanguage);