feat: version 2.9.1 (#207)
* feat: i18n * chore: format * feat: 补充遗漏翻译 * chore: update deps * feat: 复制代码块[#196][#197] * chore: version 2.9.1main
parent
21cf1bdd9e
commit
f19998d59b
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,41 @@
|
||||
export default {
|
||||
common: {
|
||||
delete: 'Delete',
|
||||
save: 'Save',
|
||||
reset: 'Reset',
|
||||
yes: 'Yes',
|
||||
no: 'No',
|
||||
noData: 'No Data',
|
||||
wrong: 'Something went wrong, please try again later.',
|
||||
success: 'Success',
|
||||
failed: 'Failed',
|
||||
},
|
||||
chat: {
|
||||
placeholder: 'Ask me anything...(Shift + Enter = line break)',
|
||||
placeholderMobile: 'Ask me anything...',
|
||||
copy: 'Copy',
|
||||
copied: 'Copied',
|
||||
copyCode: 'Copy Code',
|
||||
clearChat: 'Clear Chat',
|
||||
clearChatConfirm: 'Are you sure to clear this chat?',
|
||||
deleteMessage: 'Delete Message',
|
||||
deleteMessageConfirm: 'Are you sure to delete this message?',
|
||||
deleteHistoryConfirm: 'Are you sure to clear this history?',
|
||||
},
|
||||
setting: {
|
||||
setting: 'Setting',
|
||||
general: 'General',
|
||||
config: 'Config',
|
||||
avatarLink: 'Avatar Link',
|
||||
name: 'Name',
|
||||
description: 'Description',
|
||||
resetUserInfo: 'Reset UserInfo',
|
||||
theme: 'Theme',
|
||||
language: 'Language',
|
||||
api: 'API',
|
||||
reverseProxy: 'Reverse Proxy',
|
||||
timeout: 'Timeout',
|
||||
socks: 'Socks',
|
||||
},
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
import type { App } from 'vue'
|
||||
import { createI18n } from 'vue-i18n'
|
||||
import en from './en-US'
|
||||
import cn from './zh-CN'
|
||||
import { useAppStoreWithOut } from '@/store/modules/app'
|
||||
import type { Language } from '@/store/modules/app/helper'
|
||||
|
||||
const appStore = useAppStoreWithOut()
|
||||
|
||||
const defaultLocale = appStore.language || 'zh-CN'
|
||||
|
||||
const i18n = createI18n({
|
||||
locale: defaultLocale,
|
||||
fallbackLocale: 'en-US',
|
||||
allowComposition: true,
|
||||
messages: {
|
||||
'en-US': en,
|
||||
'zh-CN': cn,
|
||||
},
|
||||
})
|
||||
|
||||
export function t(key: string) {
|
||||
return i18n.global.t(key)
|
||||
}
|
||||
|
||||
export function setLocale(locale: Language) {
|
||||
i18n.global.locale = locale
|
||||
}
|
||||
|
||||
export function setupI18n(app: App) {
|
||||
app.use(i18n)
|
||||
}
|
||||
|
||||
export default i18n
|
@ -0,0 +1,18 @@
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
export function useCopyCode() {
|
||||
function copyCodeBlock() {
|
||||
const codeBlockWrapper = document.querySelectorAll('.code-block-wrapper')
|
||||
codeBlockWrapper.forEach((wrapper) => {
|
||||
const copyBtn = wrapper.querySelector('.code-block-header__copy')
|
||||
const codeBlock = wrapper.querySelector('.code-block-body')
|
||||
if (copyBtn && codeBlock) {
|
||||
copyBtn.addEventListener('click', () => {
|
||||
navigator.clipboard.writeText(codeBlock.textContent ?? '')
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => copyCodeBlock())
|
||||
}
|
Loading…
Reference in New Issue