jitsi-meet/react/features/base/i18n/languageDetector.native.js
Saúl Ibarra Corretgé 26ba974757 [RN] Drop react-native-locale-detector dependency
The upstream package has been unmaintained for 2 years now, and making the litle
changes needed as React Native needs them is getting old. The actual
funcionality is a couple of one-liners plus tons of boliterplate, which gets
reduced by quite a bit if we just embed it. So here it goes.
2018-12-03 11:48:44 +01:00

27 lines
488 B
JavaScript

// @flow
import { NativeModules } from 'react-native';
/**
* The singleton language detector for React Native which uses the system-wide
* locale.
*/
export default {
/**
* Does not support caching.
*
* @returns {void}
*/
cacheUserLanguage: Function.prototype,
detect() {
const { LocaleDetector } = NativeModules;
return LocaleDetector.locale.replace(/_/, '-');
},
init: Function.prototype,
type: 'languageDetector'
};