Skip to content

Commit

Permalink
reusable getLocale
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Jan 4, 2025
1 parent 1ef13af commit 9ee2112
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const messages = {
'zh-CN': zhCN,
}

function getLocale() {
export function getLocale(messages: { [key: string]: any }) {
for (const language of navigator.languages) {
if (language in messages) {
return language
Expand All @@ -21,7 +21,7 @@ function getLocale() {
}

const i18n = createI18n({
locale: getLocale(),
locale: getLocale(messages),
messages,
})

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export { default as AdvancedConfig } from './AdvancedConfig.vue'
export { default as GearButton } from './GearButton.vue'
export { default as GlobalConfig } from './GlobalConfig.vue'
export { getLocale } from './i18n'
export { default as InputMethodConfig } from './InputMethodConfig.vue'
export { default as PluginManager } from './PluginManager.vue'
export { default as ThemeConfig } from './ThemeConfig.vue'

0 comments on commit 9ee2112

Please sign in to comment.