Refactor UUID generation, remove unused logger and encryption utilities, and clean up request handling
- Updated `generateUUID` function for improved readability and performance. - Deleted `logger.ts`, `other.ts`, `request.ts`, `storage.ts`, `tansParams.ts`, and `validate.ts` as they were no longer needed. - Simplified TypeScript configuration by removing unnecessary paths and aliases. - Enhanced Vite configuration for better project structure and maintainability.
This commit is contained in:
@@ -1,21 +1,18 @@
|
||||
import { CONFIG_KEYS } from '@lib/constants'
|
||||
import { CONFIG_KEYS } from '@runtime/lib/constants'
|
||||
import logManager from '@electron/service/logger'
|
||||
import configManager from '@electron/service/config-service'
|
||||
import path from 'node:path'
|
||||
import { app } from 'electron'
|
||||
import { runtimeLocaleMessages, type RuntimeMessageTree } from '@runtime/locales/messages'
|
||||
|
||||
import en from '@locales/en.json'
|
||||
import zh from '@locales/zh.json'
|
||||
|
||||
type MessageSchema = typeof zh;
|
||||
const messages: Record<string, MessageSchema> = { en, zh }
|
||||
const messages: Record<string, RuntimeMessageTree> = runtimeLocaleMessages
|
||||
|
||||
export function createTranslator() {
|
||||
return (key?: string) => {
|
||||
if (!key) return void 0;
|
||||
try {
|
||||
const keys = key?.split('.');
|
||||
let result: any = messages[configManager.get(CONFIG_KEYS.LANGUAGE)];
|
||||
let result: any = messages[configManager.get(CONFIG_KEYS.LANGUAGE)] ?? messages.zh;
|
||||
for (const _key of keys) {
|
||||
result = result[_key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user