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.

languageDetector.native.js 488B

1234567891011121314151617181920212223242526
  1. // @flow
  2. import { NativeModules } from 'react-native';
  3. /**
  4. * The singleton language detector for React Native which uses the system-wide
  5. * locale.
  6. */
  7. export default {
  8. /**
  9. * Does not support caching.
  10. *
  11. * @returns {void}
  12. */
  13. cacheUserLanguage: Function.prototype,
  14. detect() {
  15. const { LocaleDetector } = NativeModules;
  16. return LocaleDetector.locale.replace(/_/, '-');
  17. },
  18. init: Function.prototype,
  19. type: 'languageDetector'
  20. };