@@ -15,16 +13,15 @@
-> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-background-timer)
-
+> [!TIP] [GitHub address](https://github.com/react-native-oh-library/react-native-background-timer)
-## 安装与使用
+## Installation and Usage
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-background-timer Releases](https://github.com/react-native-oh-library/react-native-background-timer/releases),并下载适用版本的 tgz 包。
+Find the matching version information in the release address of a third-party library and download an applicable .tgz package: [@react-native-oh-tpl/react-native-background-timer Releases](https://github.com/react-native-oh-library/react-native-background-timer/releases).
-进入到工程目录并输入以下命令:
+Go to the project directory and execute the following instruction:
-> [!TIP] # 处替换为 tgz 包的路径
+> [!TIP] Replace the content with the path of the .tgz package at the comment sign (#).
@@ -42,9 +39,9 @@ yarn add @react-native-oh-tpl/react-native-background-timer@file:#
-下面的代码展示了这个库的基本使用场景:
+The following code shows the basic use scenario of the repository:
-> [!WARNING] 使用时 import 的库名不变。
+> [!WARNING] The name of the imported repository remains unchanged.
```js
import {View, Button, StyleSheet, Text,TextInput} from 'react-native';
@@ -53,37 +50,34 @@ import BackgroundTimer from "react-native-background-timer";
export function BackgroundTimerExample() {
let [count, setCount] = useState(0);
let [text, setText] = useState("");
- // BackgroundTimer延时
let [delay, setDelay] = useState("1000");
- // setTimeout延时
let [timeoutDelay, setTimeoutDelay] = useState("1000");
- // setInterval延时
let [intervalDelay, setIntervalDelay] = useState("1000");
let timeoutList:number[] = []
let [intervalList, setIntervalList] = useState([]);
-
+
// runBackgroundTimer
function onPressStart(){
- setText("开启定时器...")
+ setText("Turn on the timer...")
BackgroundTimer.runBackgroundTimer(()=>{
setCount(count+=1)
},parseInt(delay))
}
function onPressStop(){
- setText("结束定时器")
+ setText("Turn off the timer")
BackgroundTimer.stopBackgroundTimer()
}
// setTimeout
function setTimeoutStart(){
- setText("开启定时器...")
+ setText("Turn on the timer...")
let timeoutId = BackgroundTimer.setTimeout(()=>{
setCount(count+=1)
},parseInt(timeoutDelay))
timeoutList.push(timeoutId)
}
function setTimeoutStop(){
- setText("结束定时器")
+ setText("Turn off the timer")
if(timeoutList.length>0){
BackgroundTimer.clearTimeout(timeoutList[0])
timeoutList.shift()
@@ -92,14 +86,14 @@ export function BackgroundTimerExample() {
// setInterval
function setIntervalStart(){
- setText("开启定时器...")
+ setText("Turn on the timer...")
let intervalId = BackgroundTimer.setInterval(()=>{
setCount(count+=1)
},parseInt(intervalDelay))
setIntervalList([...intervalList,intervalId])
}
function setIntervalStop(){
- setText("结束定时器")
+ setText("Turn off the timer")
if(intervalList.length>0){
BackgroundTimer.clearInterval(intervalList[0])
intervalList.shift()
@@ -119,7 +113,7 @@ export function BackgroundTimerExample() {
/>
{setDelay(value)}}
value={delay}
/>
@@ -131,7 +125,7 @@ export function BackgroundTimerExample() {
/>
-
+
{setTimeoutDelay(value)}}
value={timeoutDelay}
/>
@@ -152,7 +146,7 @@ export function BackgroundTimerExample() {
/>
-
+
-
+
@@ -458,14 +455,14 @@ export default function InCallManagerExample() {
onPress={() => {
setFlashOn(true, 100);
}}>
- setFlashOn=true(Android不支持)
+ setFlashOn=true(Android is not supported) {
setFlashOn(false, 50);
}}>
- setFlashOn=false(Android不支持)
+ setFlashOn=false(Android is not supported) [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
+> [!TIP] The HAR file is stored in the `harmony` directory in the installation path of the third-party library.
-打开 `entry/oh-package.json5`,添加以下依赖
+Open `entry/oh-package.json5` file and add the following dependencies:
```json
"dependencies": {
@@ -527,22 +522,22 @@ export default function InCallManagerExample() {
}
```
-点击右上角的 `sync` 按钮
+Click the `sync` button in the upper right corner.
-或者在终端执行:
+Alternatively, run the following instruction on the terminal:
```bash
cd entry
ohpm install
```
-方法二:直接链接源码
+Method 2: Directly link to the source code.
-> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md)
+> [!TIP] For details, see [Directly Linking Source Code](/en/link-source-code.md).
-### 3.配置 CMakeLists 和引入 RNInCallManagerPackage
+### 3. Configuring CMakeLists and Introducing RNInCallManagerPackage
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+Open `entry/src/main/cpp/CMakeLists.txt` and add the following code:
```diff
project(rnapp)
@@ -580,7 +575,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
# RNOH_END: manual_package_linking_2
```
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+Open `entry/src/main/cpp/PackageProvider.cpp` and add the following code:
```diff
#include "RNOH/PackageProvider.h"
@@ -597,9 +592,9 @@ std::vector> PackageProvider::getPackages(Package::Cont
}
```
-### 4.在 ArkTs 侧引入 RNInCallManagerPackage
+### 4. Introducing RNInCallManagerPackage to ArkTS
-打开 `entry/src/main/ets/RNPackagesFactory.ts`,或者`entry/src/main/ets/rn/RNPackagesFactory.ts`,添加:
+Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following code:
```diff
+ import { RNInCallManagerPackage } from '@react-native-oh-tpl/react-native-incall-manager/ts';
@@ -612,34 +607,35 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
}
```
-### 5.运行
+### 5. Running
-点击右上角的 `sync` 按钮
+Click the `sync` button in the upper right corner.
-或者在终端执行:
+Alternatively, run the following instruction on the terminal:
```bash
cd entry
ohpm install
```
-然后编译、运行即可。
+Then build and run the code.
-## 约束与限制
-### 兼容性
+## Constraints
+### Compatibility
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone.
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-incall-manager Releases](https://github.com/react-native-oh-library/react-native-incall-manager/releases)
+Check the release version information in the release address of the third-party library: [@react-native-oh-tpl/react-native-incall-manager Releases](https://github.com/react-native-oh-library/react-native-incall-manager/releases)
+### Permission Requirements
-### 应用权限申请
> [!TIP] "ohos.permission.RUNNING_LOCK","ohos.permission.KEEP_BACKGROUND_RUNNING"权限等级为normal,授权方式为system_grant
> "ohos.permission.MICROPHONE"权限等级为normal,授权方式为user_grant,[使用 ACL 签名的配置指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/signing-0000001587684945-V3#section157591551175916)
-#### 在 entry 目录下的module.json5中添加权限
-在 `YourProject/entry/src/main/module.json5`补上配置
+#### Include applicable permissions in the module.json5 file within the entry directory.
+
+Add configuration to `YourProject/entry/src/main/module.json5`
```diff
{
@@ -656,7 +652,7 @@ ohpm install
+ "reason": "$string:Access_micphone",
+ "usedScene": {"when": "inuse"}
+ },
-+ { "name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
++ { "name": "ohos.permission.KEEP_BACKGROUND_RUNNING",
+ "usedScene": {
+ "when": "always"
+ }
@@ -665,11 +661,12 @@ ohpm install
}
}
```
-在 `YourProject/entry/src/main/resources/base/element/string.json`补上配置
-#### 在 entry 目录下添加申请权限的原因
+Add configuration to `YourProject/entry/src/main/resources/base/element/string.json`
-打开 `entry/src/main/resources/base/element/string.json`,添加:
+#### Apply the reasons for applicable permission in the entry directory.
+
+Open `entry/src/main/resources/base/element/string.json` file and add:
```diff
...
@@ -683,63 +680,60 @@ ohpm install
}
```
-
-
-## 静态方法
-
-> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
-
-> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
-
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ---- | ----------- | ---- | -------- | -------- | ------------------ |
-| vibrate | set vibrate true / false | boolean | no | all | yes |
-| start | start incall manager.ringback accept non-empty string or it won't play default: \{media:'audio', auto: true, ringback: ''\} | (setup?: \{auto?: boolean;media?: "video" \| "audio";ringback?: string;\}) => void | no | all | yes |
-| stop | stop incall manager,busytone accept non-empty string or it won't play,default: \{busytone: ''\} | (setup?: \{ busytone?: string \}) => void | no | all | partially |
-| turnScreenOn | force turn screen on | () => void | no | Android | yes |
-| turnScreenOff | turn screen off | () => void | no | Android | yes |
-| setKeepScreenOn | set KeepScreenOn flag = true or false,default: false | (enable: boolean) => void | no | all | yes |
-| setSpeakerphoneOn | toggle speaker ON/OFF once. but not force,default: false | (enable: boolean) => void | no | all | no |
-| setForceSpeakerphoneOn | true -> force speaker on,false -> force speaker off,null -> use default behavior according to media type,default: null | (flag: boolean) => void | no | all | no |
-| setMicrophoneMute | mute/unmute micophone,default: false,p.s. if you use webrtc, you can just use track.enabled = false to mute | (enable: boolean) => void | no | Android | no |
-| getAudioUri | get audio Uri path. this would be useful when you want to pass Uri into another module. | (audioType: string, fileType: string) => Promise | no | all | yes |
-| startRingtone | play ringtone.ringtone: 'DEFAULT' or 'BUNDLE',vibrate_pattern: same as RN, but does not support repeat,ios_category: ios only, if you want to use specific audio category,seconds: android only, specify how long do you want to play rather than play once nor repeat. in sec. | (ringtone: string,vibrate_pattern: number | number\[],ios_category: string,seconds: number) => void | no | all | partially |
-| stopRingtone | stop play ringtone if previous started via | () => void | no | all | yes |
-| startRingback | play ringback.,ringback: '_DEFAULT_' or '_DTMF_' | (ringback: string) => void; | no | all | partially |
-| stopRingback | stop play ringback if previous started via start() | () => void | no | all | yes |
-| stopProximitySensor | stop ProximitySensor | () => void | no | all | yes |
-| startProximitySensor | start proximitySensor | () => void | no | all | yes |
-| pokeScreen | poke screen | (timeout: number) => void | no | Android | no |
-| chooseAudioRoute | choose audio route | (route: string) => Promise | no | Android | no |
-| requestAudioFocus | request audio focus | () => Promise | no | Android | no |
-| abandonAudioFocus | abandon audio focus | () => Promise | no | Android | no |
-| setFlashOn | set flash light on/off | (enable: boolean, brightness: number) => void | no | iOS | yes |
-| getIsWiredHeadsetPluggedIn | return wired headset plugged in state | () => Promise<\{ isWiredHeadsetPluggedIn: boolean \}> | no | all | yes |
-
-### Event(事件监听)
-
-> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
-
-> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
-
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ---- | ----------- | ---- | -------- | -------- | ------------------ |
-| Proximity | proximity sensor detected changes. | (data: \{'isNear': boolean\}) => void | no | all | yes |
-| WiredHeadset | fire when wired headset plug/unplug | (data: \{'isPlugged': boolean, 'hasMic': boolean, 'deviceName': string \}) => void | no | all | yes |
-| NoisyAudio | a hint for applications that audio is about to become 'noisy' due to a change in audio outputs. | () => void | no | Android | yes |
-| MediaButton | when external device controler pressed button | (data: \{'eventText': string, 'eventCode': number \}) => void | no | Android | yes |
-| onAudioFocusChange | Called on the listener to notify it the audio focus for this listener has been changed. | (data: \{'eventText': string, 'eventCode': number }) => void | no | Android | yes |
-
-
-## 遗留问题
-
-- [ ] 打开关闭麦克风静音setMicrophoneMute,未实现 HarmonyOS化 问题: [issue#1](https://github.com/react-native-oh-library/react-native-incall-manager/issues/1)
-- [ ] 播放获取系统铃声,未实现 HarmonyOS化 问题: [issue#2](https://github.com/react-native-oh-library/react-native-incall-manager/issues/2)
-- [ ] 手动切换输出设备扬声器与听筒切换setSpeakerphoneOn、setForceSpeakerphoneOn,未实现 HarmonyOS化 问题: [issue#3](https://github.com/react-native-oh-library/react-native-incall-manager/issues/3)
-- [ ] 手动切换音频输入输出设备chooseAudioRoute,未实现 HarmonyOS化 问题: [issue#4](https://github.com/react-native-oh-library/react-native-incall-manager/issues/4)
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The ISC License (ISC)](https://github.com/react-native-webrtc/react-native-incall-manager/blob/master/LICENSE) ,请自由地享受和参与开源。
+## Static method
+
+> [!TIP] The **Platform** column indicates the platform where the properties are supported in the original third-party library.
+
+> [!TIP] If the value of **HarmonyOS Support** is **yes**, it means that the HarmonyOS platform supports this property; **no** means the opposite; **partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ------------------------------------------------------- | -------- | ----------------- | --------- |
+| vibrate | set vibrate true / false | boolean | no | all | yes |
+| start | start incall manager.ringback accept non-empty string or it won't play default: \{media:'audio', auto: true, ringback: ''\} | (setup?: \{auto?: boolean;media?: "video" \| "audio";ringback?: string;\}) => void | no | all | yes |
+| stop | stop incall manager,busytone accept non-empty string or it won't play,default: \{busytone: ''\} | (setup?: \{ busytone?: string \}) => void | no | all | partially |
+| turnScreenOn | force turn screen on | () => void | no | Android | yes |
+| turnScreenOff | turn screen off | () => void | no | Android | yes |
+| setKeepScreenOn | set KeepScreenOn flag = true or false,default: false | (enable: boolean) => void | no | all | yes |
+| setSpeakerphoneOn | toggle speaker ON/OFF once. but not force,default: false | (enable: boolean) => void | no | all | no |
+| setForceSpeakerphoneOn | true -> force speaker on,false -> force speaker off,null -> use default behavior according to media type,default: null | (flag: boolean) => void | no | all | no |
+| setMicrophoneMute | mute/unmute micophone,default: false,p.s. if you use webrtc, you can just use track.enabled = false to mute | (enable: boolean) => void | no | Android | no |
+| getAudioUri | get audio Uri path. this would be useful when you want to pass Uri into another module. | (audioType: string, fileType: string) => Promise | no | all | yes |
+| startRingtone | play ringtone.ringtone: 'DEFAULT' or 'BUNDLE',vibrate_pattern: same as RN, but does not support repeat,ios_category: ios only, if you want to use specific audio category,seconds: android only, specify how long do you want to play rather than play once nor repeat. in sec. | (ringtone: string,vibrate_pattern: number | number\[],ios_category: string,seconds: number) => void | no | all | partially |
+| stopRingtone | stop play ringtone if previous started via | () => void | no | all | yes |
+| startRingback | play ringback.,ringback: '_DEFAULT_' or '_DTMF_' | (ringback: string) => void; | no | all | partially |
+| stopRingback | stop play ringback if previous started via start() | () => void | no | all | yes |
+| stopProximitySensor | stop ProximitySensor | () => void | no | all | yes |
+| startProximitySensor | start proximitySensor | () => void | no | all | yes |
+| pokeScreen | poke screen | (timeout: number) => void | no | Android | no |
+| chooseAudioRoute | choose audio route | (route: string) => Promise | no | Android | no |
+| requestAudioFocus | request audio focus | () => Promise | no | Android | no |
+| abandonAudioFocus | abandon audio focus | () => Promise | no | Android | no |
+| setFlashOn | set flash light on/off | (enable: boolean, brightness: number) => void | no | iOS | yes |
+| getIsWiredHeadsetPluggedIn | return wired headset plugged in state | () => Promise<\{ isWiredHeadsetPluggedIn: boolean \}> | no | all | yes |
+
+### Event(Event Listening)
+
+> [!TIP] The **Platform** column indicates the platform where the properties are supported in the original third-party library.
+
+> [!TIP] If the value of **HarmonyOS Support** is **yes**, it means that the HarmonyOS platform supports this property; **no** means the opposite; **partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ------------------ | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | -------- | -------- | ----------------- |
+| Proximity | proximity sensor detected changes. | (data: \{'isNear': boolean\}) => void | no | all | yes |
+| WiredHeadset | fire when wired headset plug/unplug | (data: \{'isPlugged': boolean, 'hasMic': boolean, 'deviceName': string \}) => void | no | all | yes |
+| NoisyAudio | a hint for applications that audio is about to become 'noisy' due to a change in audio outputs. | () => void | no | Android | yes |
+| MediaButton | when external device controler pressed button | (data: \{'eventText': string, 'eventCode': number \}) => void | no | Android | yes |
+| onAudioFocusChange | Called on the listener to notify it the audio focus for this listener has been changed. | (data: \{'eventText': string, 'eventCode': number }) => void | no | Android | yes |
+
+## Known Issues
+
+- [ ] 打开关闭麦克风静音 setMicrophoneMute,未实现 HarmonyOS 化 问题: [issue#1](https://github.com/react-native-oh-library/react-native-incall-manager/issues/1)
+- [ ] 播放获取系统铃声,未实现 HarmonyOS 化 问题: [issue#2](https://github.com/react-native-oh-library/react-native-incall-manager/issues/2)
+- [ ] 手动切换输出设备扬声器与听筒切换 setSpeakerphoneOn、setForceSpeakerphoneOn,未实现 HarmonyOS 化 问题: [issue#3](https://github.com/react-native-oh-library/react-native-incall-manager/issues/3)
+- [ ] 手动切换音频输入输出设备 chooseAudioRoute,未实现 HarmonyOS 化 问题: [issue#4](https://github.com/react-native-oh-library/react-native-incall-manager/issues/4)
+
+## Others
+
+## License
+
+This project is licensed under [The ISC License (ISC)](https://github.com/react-native-webrtc/react-native-incall-manager/blob/master/LICENSE).
diff --git a/en/react-native-mlkit-ocr.md b/en/react-native-mlkit-ocr.md
index 55d6e93092bb934d92f9a0a8806fef3780618a05..4df5bdba8a82d9269b280f1f1dcdcff7034503c9 100644
--- a/en/react-native-mlkit-ocr.md
+++ b/en/react-native-mlkit-ocr.md
@@ -1,4 +1,4 @@
-> 模板版本:v0.2.2
+> Template version: v0.2.2
react-native-mlkit-ocr
@@ -12,15 +12,15 @@
-> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-mlkit-ocr)
+> [!TIP] [GitHub address](https://github.com/react-native-oh-library/react-native-mlkit-ocr)
-## 安装与使用
+## Installation and Usage
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-mlkit-ocr Releases](https://github.com/react-native-oh-library/react-native-mlkit-ocr/releases),并下载适用版本的 tgz 包。
+Find the matching version information in the release address of a third-party library and download an applicable .tgz package: [@react-native-oh-tpl/react-native-mlkit-ocr Releases](https://github.com/react-native-oh-library/react-native-mlkit-ocr/releases).
-进入到工程目录并输入以下命令:
+Go to the project directory and execute the following instruction:
-> [!TIP] # 处替换为 tgz 包的路径
+> [!TIP] Replace the content with the path of the .tgz package at the comment sign (#).
@@ -38,9 +38,9 @@ yarn add @react-native-oh-tpl/react-native-mlkit-ocr@file:#
-下面的代码展示了这个库的基本使用场景:
+The following code shows the basic use scenario of the repository:
-> [!WARNING] 使用时 import 的库名不变。
+> [!WARNING] The name of the imported repository remains unchanged.
```js
import * as React from 'react';
@@ -108,7 +108,7 @@ export const OcrTest = () => {
)}