refactor: reorganize project structure and implement self-managed i18n/theme for components

This commit is contained in:
yuding
2025-12-04 15:24:44 +08:00
parent 4dd923f19e
commit c45cdc9f7d
41 changed files with 3081 additions and 2010 deletions

24
src/locales/en-US.ts Normal file
View File

@@ -0,0 +1,24 @@
import { TranslationDictionary } from './types';
export const enUS: TranslationDictionary = {
common: {
title: 'BimEngine',
description: 'This is a BIM-ENGINE demo.',
openTestDialog: 'Open Test Dialog',
openInfoDialog: 'Open Info Dialog (Wrapped)',
},
toolbar: {
home: 'Home',
info: 'Info',
location: 'Location',
setting: 'Settings',
walk: 'Walk',
walkPerson: 'Person',
walkBird: 'Bird Eye',
walkMenu: 'Menu',
},
dialog: {
testTitle: 'Test Dialog',
testContent: '<div style="padding: 10px;">This is a <b>draggable</b> and <b>resizable</b> dialog.<br><br>Try dragging the title bar or resizing from the bottom-right corner.</div>',
},
};

31
src/locales/types.ts Normal file
View File

@@ -0,0 +1,31 @@
/**
* 翻译字典接口
* 定义所有可用的翻译键值对结构,保证类型安全
*/
export interface TranslationDictionary {
common: {
title: string;
description: string;
openTestDialog: string;
openInfoDialog: string;
};
toolbar: {
home: string;
info: string;
location: string;
setting: string;
walk: string;
walkPerson: string;
walkBird: string;
walkMenu: string;
};
dialog: {
testTitle: string;
testContent: string;
};
}
/**
* 语言代码类型
*/
export type LocaleType = 'zh-CN' | 'en-US';

24
src/locales/zh-CN.ts Normal file
View File

@@ -0,0 +1,24 @@
import { TranslationDictionary } from './types';
export const zhCN: TranslationDictionary = {
common: {
title: 'BimEngine',
description: '这是一个使用 BIM-ENGINE。',
openTestDialog: '打开测试弹窗',
openInfoDialog: '打开信息弹窗 (封装版)',
},
toolbar: {
home: '首页',
info: '信息',
location: '定位',
setting: '设置',
walk: '漫游',
walkPerson: '人视',
walkBird: '鸟瞰',
walkMenu: '菜单',
},
dialog: {
testTitle: '测试弹窗',
testContent: '<div style="padding: 10px;">这是一个 <b>可拖拽</b> 且 <b>可缩放</b> 的弹窗。<br><br>你可以尝试拖动标题栏,或者拖动右下角改变大小。</div>',
},
};