Files
Enterprise-Knowledge-Base/frontend/src/stores/menu.ts
T
Aleksandr da640d1d33 Feature/add multilingual support (#384)
* feat: add multilingual support (English and Russian)

- Add i18n infrastructure with vue-i18n
- Implement language switcher component
- Add Russian (ru-RU) and English (en-US) translations
- Configure TDesign locale for proper UI component translation
- Replace hardcoded Chinese strings with i18n keys
- Support dynamic language switching in all components
- Add translations for all UI elements including:
  - Menu items and navigation
  - Knowledge base management
  - Chat interface
  - Settings and initialization
  - Authentication pages
  - Separator options in document splitting

This enables users to use the application in Chinese, English, or Russian.

* chore: add vue-i18n dependency and fix Input-field i18n integration

- Add vue-i18n package to frontend dependencies
- Fix Input-field component i18n integration for multilingual support

* chore: add PROGRESS_RU.md to .gitignore

- Exclude personal progress tracking file from git

* rearrange the order of the multilingual languages: Chinese, English, Russian

* Delete docker-compose.yml

* Replaced hardcoded messages with the t() function in the following files:  all error messages, 14 console.error ,messages session creation messages
, login/registration errors

* fix: restore docker-compose.yml and update .gitignore

* restore docker-compose.yml latest

* add multilingual support
2025-11-05 12:32:16 +08:00

51 lines
1.5 KiB
TypeScript

import { ref, computed, reactive } from 'vue'
import { defineStore } from 'pinia';
export const useMenuStore = defineStore('menuStore', {
state: () => ({
menuArr: reactive([
{ titleKey: 'menu.knowledgeBase', icon: 'zhishiku', path: 'knowledge-bases' },
{
titleKey: 'menu.chat',
icon: 'prefixIcon',
path: 'creatChat',
childrenPath: 'chat',
children: reactive<object[]>([]),
},
{ titleKey: 'menu.tenant', icon: 'tenant', path: 'tenant' },
{ titleKey: 'menu.logout', icon: 'logout', path: 'logout' }
]),
isFirstSession: false,
firstQuery: ''
}
),
actions: {
clearMenuArr() {
this.menuArr[1].children = reactive<object[]>([]);
},
updatemenuArr(obj: any) {
this.menuArr[1].children?.push(obj);
},
updataMenuChildren(item: object) {
this.menuArr[1].children?.unshift(item)
},
updatasessionTitle(session_id: string, title: string) {
this.menuArr[1].children?.forEach((item: any) => {
if (item.id == session_id) {
item.title = title;
item.isNoTitle = false;
}
});
},
changeIsFirstSession(payload: boolean) {
this.isFirstSession = payload;
},
changeFirstQuery(payload: string) {
this.firstQuery = payload;
}
}
});