public Locale inferDeviceLocale ( Context context ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . N ) { return context . getResources ( ) . getConfiguration ( ) . getLocales ( ) . get ( 0 ) ; } else { return context . getResources ( ) . getConfiguration ( ) . locale ; } }
Returns the device locale for which to use as a default if no language is specified