You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
361 B
11 lines
361 B
// @flow
|
|
import memoize from 'lodash/memoize'
|
|
|
|
const parse = memoize(navLang => {
|
|
const localeSplit = (navLang || '').split('-')
|
|
const language = (localeSplit[0] || '').toLowerCase() || null
|
|
const region = (localeSplit[1] || '').toUpperCase() || null
|
|
return { language, region }
|
|
})
|
|
|
|
export const getSystemLocale = () => parse(window.navigator.language)
|
|
|