forked from blossom-editor/blossom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
// 正常工作。 | ||
export {} | ||
|
||
declare module '@renderer/assets/iconfont/iconfont.js' | ||
declare module 'highlight.js' | ||
declare module 'katex' | ||
declare module 'katex' | ||
|
||
declare module 'vue' { | ||
interface ComponentCustomProperties { | ||
$t: (key: string) => string | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
export const all = { | ||
treedoc: { | ||
loading: 'One moment please...' | ||
import type { Temp } from './types' | ||
|
||
export const en: Temp = { | ||
editor: { | ||
treeDoc: { | ||
loading: 'loading....' | ||
} | ||
}, | ||
picture: { | ||
treeDoc: { | ||
loading: '' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { App } from 'vue' | ||
import { useI18n } from './useI18n' | ||
|
||
const i18n = useI18n() | ||
|
||
export default { | ||
install: (app: App) => { | ||
app.config.globalProperties.$t = (key: string) => { | ||
return i18n.getValue(key) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const template = { | ||
editor: { | ||
treeDoc: { | ||
loading: '' | ||
} | ||
}, | ||
picture: { | ||
treeDoc: { | ||
loading: '' | ||
} | ||
} | ||
} | ||
export type Temp = typeof template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { ref } from 'vue' | ||
import { zhCn } from './zh-cn' | ||
import { en } from './en' | ||
import { Temp } from './types' | ||
|
||
const locale = ref('zhCn') | ||
|
||
export const useI18n = () => { | ||
const getValue = (key: string): string => { | ||
let k: any = key.split('.').reduce((o, i) => { | ||
if (o) { | ||
return o[i] | ||
} | ||
}, getLocale()) | ||
return k as string | ||
} | ||
const getLocale = (): Temp => { | ||
let l = locale.value | ||
if (l === 'zh-cn') { | ||
return zhCn | ||
} | ||
if (l === 'en') { | ||
return en | ||
} | ||
return zhCn | ||
} | ||
|
||
return { | ||
locale, | ||
getValue, | ||
getLocale | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { Temp } from './types' | ||
|
||
export const zhCn: Temp = { | ||
editor: { | ||
treeDoc: { | ||
loading: '加载中' | ||
} | ||
}, | ||
picture: { | ||
treeDoc: { | ||
loading: '' | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters