@bsky.app/expo-translate-text 0.2.1 → 0.2.3
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 +26 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# expo-translate-text 🌍
|
|
2
2
|
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This is a fork of [TomAtterton/expo-translate-text](https://github.com/TomAtterton/expo-translate-text)
|
|
5
|
+
|
|
3
6
|
`expo-translate-text` is a React Native module for translating text using platform-specific translation APIs. It leverages Apple's **[iOS Translation API](https://developer.apple.com/documentation/translation)** (with **Translation Sheet** available in **iOS 17.4+**) and **[Google ML Kit](https://developers.google.com/ml-kit/language/translation/overview)** on Android for seamless text translation.
|
|
4
7
|
|
|
5
8
|

|
|
@@ -8,25 +11,22 @@
|
|
|
8
11
|

|
|
9
12
|

|
|
10
13
|
|
|
11
|
-
|
|
12
14
|
## Demo 💫
|
|
13
15
|
|
|
14
16
|

|
|
15
17
|
|
|
16
|
-
|
|
17
18
|
## Installation 📦
|
|
18
19
|
|
|
19
|
-
|
|
20
20
|
```sh
|
|
21
21
|
expo install expo-translate-text
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
## Platform Support 📱
|
|
25
25
|
|
|
26
|
-
| Platform
|
|
27
|
-
|
|
28
|
-
| iOS
|
|
29
|
-
| Android
|
|
26
|
+
| Platform | Translation Task | Translation Sheet |
|
|
27
|
+
| -------- | ---------------------- | ------------------------ |
|
|
28
|
+
| iOS | ✅ Supported (iOS 18+) | ✅ Supported (iOS 17.4+) |
|
|
29
|
+
| Android | ✅ Supported | ❌ Not Supported |
|
|
30
30
|
|
|
31
31
|
## Usage 🚀
|
|
32
32
|
|
|
@@ -51,7 +51,6 @@ const translateText = async () => {
|
|
|
51
51
|
|
|
52
52
|
### Translation Sheet (iOS Only)
|
|
53
53
|
|
|
54
|
-
|
|
55
54
|
```tsx
|
|
56
55
|
import { onTranslateSheet } from 'expo-translate-text';
|
|
57
56
|
import { Platform } from 'react-native';
|
|
@@ -76,25 +75,26 @@ const translateSheet = async () => {
|
|
|
76
75
|
## API Reference 📖
|
|
77
76
|
|
|
78
77
|
### onTranslateTask
|
|
78
|
+
|
|
79
79
|
Translates a given text or batch of text.
|
|
80
80
|
|
|
81
81
|
**Request:**
|
|
82
82
|
|
|
83
|
-
| Parameter
|
|
84
|
-
|
|
85
|
-
| `input`
|
|
86
|
-
| `sourceLangCode?`
|
|
87
|
-
| `targetLangCode`
|
|
88
|
-
| `requireCharging?` | `boolean`
|
|
89
|
-
| `requiresWifi?`
|
|
83
|
+
| Parameter | Type | Description |
|
|
84
|
+
| ------------------ | ----------------------------------------------------------------- | ---------------------------------- |
|
|
85
|
+
| `input` | `string` \| `string[]` \| `{ [key: string]: string \| string[] }` | Text to be translated. |
|
|
86
|
+
| `sourceLangCode?` | `string` | Source language code (e.g., 'en'). |
|
|
87
|
+
| `targetLangCode` | `string` | Target language code (e.g., 'es'). |
|
|
88
|
+
| `requireCharging?` | `boolean` | Requires device to be charging. |
|
|
89
|
+
| `requiresWifi?` | `boolean` | Requires WiFi for translation. |
|
|
90
90
|
|
|
91
91
|
**Response:**
|
|
92
92
|
|
|
93
|
-
Key
|
|
94
|
-
|
|
95
|
-
`translatedTexts` | `string` \| `string[]` \| `{ [key: string]: string \| string[] }` | The translated text(s).
|
|
96
|
-
`sourceLanguage`
|
|
97
|
-
`targetLanguage`
|
|
93
|
+
| Key | Type | Description |
|
|
94
|
+
| ----------------- | ----------------------------------------------------------------- | --------------------------------------------------- |
|
|
95
|
+
| `translatedTexts` | `string` \| `string[]` \| `{ [key: string]: string \| string[] }` | The translated text(s). |
|
|
96
|
+
| `sourceLanguage` | `string` \| `null` | The detected source language, or `null` if unknown. |
|
|
97
|
+
| `targetLanguage` | `string` | The requested target language. |
|
|
98
98
|
|
|
99
99
|
---
|
|
100
100
|
|
|
@@ -106,15 +106,15 @@ Translates text using the Translation Sheet API.
|
|
|
106
106
|
|
|
107
107
|
**Request:**
|
|
108
108
|
|
|
109
|
-
| Parameter | Type
|
|
110
|
-
|
|
111
|
-
| `input`
|
|
109
|
+
| Parameter | Type | Description |
|
|
110
|
+
| --------- | -------- | -------------------------- |
|
|
111
|
+
| `input` | `string` | The text to be translated. |
|
|
112
112
|
|
|
113
113
|
**Response:**
|
|
114
114
|
|
|
115
|
-
Key
|
|
116
|
-
|
|
117
|
-
`result` | `string` | The translated text.
|
|
115
|
+
| Key | Type | Description |
|
|
116
|
+
| -------- | -------- | -------------------- |
|
|
117
|
+
| `result` | `string` | The translated text. |
|
|
118
118
|
|
|
119
119
|
## Contributing 🙌
|
|
120
120
|
|