@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
16 lines (13 loc) • 415 B
text/typescript
import * as R from "ramda";
import { I18nManager } from "react-native";
// this is done because Android will return `iw` instead of `he` for the hebrew locale;
const alignLanguageCode = R.when(R.equals("iw"), R.always("he"));
export function getDeviceLocales() {
return R.compose(
Array,
alignLanguageCode,
R.head,
R.split("_"),
R.prop("localeIdentifier")
)(I18nManager.getConstants());
}