locon 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,9 +45,22 @@ cd ios && pod install
|
|
|
45
45
|
|
|
46
46
|
- `react >= 19.0.0`
|
|
47
47
|
- `react-native >= 0.70.0`
|
|
48
|
-
- `react-native-localize >= 3.0.0` (
|
|
48
|
+
- `react-native-localize >= 3.0.0` (optional, but recommended for accurate device language detection)
|
|
49
49
|
|
|
50
50
|
`react-native-localize` is used for accurate device language detection on iOS and Android.
|
|
51
|
+
It is not installed automatically — add it to your app if you want native locale detection:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
yarn add react-native-localize
|
|
55
|
+
# or
|
|
56
|
+
npm install react-native-localize
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then run iOS pods:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cd ios && pod install
|
|
63
|
+
```
|
|
51
64
|
|
|
52
65
|
---
|
|
53
66
|
|
|
@@ -113,11 +126,13 @@ export default App
|
|
|
113
126
|
If `currentLocale` is not provided and `autodetect` is `true` (default),
|
|
114
127
|
`locon` will:
|
|
115
128
|
|
|
116
|
-
1. Use `react-native-localize` to detect device locale on iOS/Android
|
|
129
|
+
1. Use `react-native-localize` (if installed) to detect device locale on iOS/Android
|
|
117
130
|
2. Match the detected locale (including region) or just language code against your `assets`
|
|
118
131
|
3. If a match is found, use it as initial locale
|
|
119
132
|
4. Otherwise, fall back to `defaultLocale`
|
|
120
133
|
|
|
134
|
+
If `react-native-localize` is not installed, `locon` falls back to the Intl API.
|
|
135
|
+
|
|
121
136
|
#### 3. Use the `useLocon()` hook
|
|
122
137
|
|
|
123
138
|
```tsx
|
package/package.json
CHANGED