MCPcopy Index your code
hub / github.com/dataease/SQLBot / getBrowserLocale

Function getBrowserLocale

frontend/src/utils/utils.ts:43–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41}
42
43export const getBrowserLocale = () => {
44 const language = navigator.language
45 if (!language) {
46 return 'zh-CN'
47 }
48 if (language.startsWith('en')) {
49 return 'en'
50 }
51 if (language.toLowerCase().startsWith('zh')) {
52 const temp = language.toLowerCase().replace('_', '-')
53 return temp === 'zh' ? 'zh-CN' : temp === 'zh-cn' ? 'zh-CN' : 'zh-TW'
54 }
55 return language
56}
57export const getLocale = () => {
58 return wsCache.get('user.language') || getBrowserLocale() || 'zh-CN'
59}

Callers 2

getDefaultLocaleFunction · 0.90
getLocaleFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected