You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@flyskywhy/react-native-locale-detector

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flyskywhy/react-native-locale-detector

Detects the locale of a user's phone.

1.0.7
latest
Source
npm
Version published
Weekly downloads
4
-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-locale-detector

Detects the locale of a user's phone. Based on react-native-i18n, but this just exports the device's locale. This isn't particularly useful on it's own and you'll probably want to use it with an i18n library like i18next.

Installation

npm install @flyskywhy/react-native-locale-detector --save

For RN < 0.60

react-native link

If got

> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR: node_modules/@flyskywhy/react-native-locale-detector/android/build/intermediates/merged_res/release/values-v26/values-v26.xml:7: AAPT: error: resource android:attr/colorError not found.

you may need add below into YOUR_APP/android/build.gradle:

subprojects {
    afterEvaluate {
        project ->
            if (project.hasProperty("android")) {
                android {
                    compileSdkVersion = rootProject.compileSdkVersion
                    buildToolsVersion = rootProject.buildToolsVersion
                }
            }
    }
}

Usage

// Import the locale.
import locale from '@flyskywhy/react-native-locale-detector'

// We could log it. Maybe it's en-US...
console.log(locale)

// Or if you're using a localization library.
yourLocalizationLibrary.setLocale(locale)

Keywords

android

FAQs

Package last updated on 26 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts