Skip to content

Commit

Permalink
feat(lang): add useBrowserLang function (#422) (#432)
Browse files Browse the repository at this point in the history
close #422
  • Loading branch information
brc-dd committed Jan 5, 2024
1 parent d706a3d commit 4af35d0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/composables/Lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ export function useTrans<T>(messages: TransMessages<T>): Trans<T> {
t
}
}

export function useBrowserLang(): Lang {
const lang = navigator.language

return lang.split('-')[0] === 'ja' ? 'ja' : 'en'
}

0 comments on commit 4af35d0

Please sign in to comment.