import merge from 'lodash/merge' ; import { DEFAULT_LOCALE } from './index' ; interface AllNavigatorLanguage extends NavigatorLanguage { browserLanguage ? : string ; userLanguage ? : string ; } example param { string } defaultLocale export const resolveBrowserLocale = ( defaultLocale = DEFAULT_LOCALE ) => { const { language , browserLanguage , userLanguage , } = window . navigator as AllNavigatorLanguage ; return ( language || browserLanguage || userLanguage || defaultLocale ) . split ( '-' ) [ 0 ] ; } ; example export const mergeTranslations = ( ... translationsModules ) => merge ( { } , ... translationsModules ) ;