未验证 提交 d7e060ba 编写于 作者: O openharmony_ci 提交者: Gitee

!15294 翻译完成 14771+14909

Merge pull request !15294 from ester.zhou/TR-14771
...@@ -15,7 +15,7 @@ You can use the APIs of this module to configure the concerned information, obta ...@@ -15,7 +15,7 @@ You can use the APIs of this module to configure the concerned information, obta
Before using the **AccessibilityExtensionContext** module, you must define a child class that inherits from **AccessibilityExtensionAbility**. Before using the **AccessibilityExtensionContext** module, you must define a child class that inherits from **AccessibilityExtensionAbility**.
```ts ```ts
import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility';
let axContext; let axContext;
class EntryAbility extends AccessibilityExtensionAbility { class EntryAbility extends AccessibilityExtensionAbility {
onConnect(): void { onConnect(): void {
...@@ -103,10 +103,10 @@ try { ...@@ -103,10 +103,10 @@ try {
axContext.setTargetBundleName(targetNames).then(() => { axContext.setTargetBundleName(targetNames).then(() => {
console.info('set target bundle names success'); console.info('set target bundle names success');
}).catch((err) => { }).catch((err) => {
console.error('failed to set target bundle names, because ' + JSON.stringify(err)); console.error('failed to set target bundle names, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to set target bundle names, because ' + JSON.stringify(exception)); console.error('failed to set target bundle names, because ${JSON.stringify(exception)}');
}; };
``` ```
...@@ -132,13 +132,13 @@ let targetNames = ['com.ohos.xyz']; ...@@ -132,13 +132,13 @@ let targetNames = ['com.ohos.xyz'];
try { try {
axContext.setTargetBundleName(targetNames, (err, data) => { axContext.setTargetBundleName(targetNames, (err, data) => {
if (err) { if (err) {
console.error('failed to set target bundle names, because ' + JSON.stringify(err)); console.error('failed to set target bundle names, because ${JSON.stringify(err)}');
return; return;
} }
console.info('set target bundle names success'); console.info('set target bundle names success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to set target bundle names, because ' + JSON.stringify(exception)); console.error('failed to set target bundle names, because ${JSON.stringify(exception)}');
}; };
``` ```
...@@ -179,10 +179,10 @@ try { ...@@ -179,10 +179,10 @@ try {
focusElement = data; focusElement = data;
console.log('get focus element success'); console.log('get focus element success');
}).catch((err) => { }).catch((err) => {
console.error('failed to get focus element, because ' + JSON.stringify(err)); console.error('failed to get focus element, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get focus element, because ' + JSON.stringify(exception)); console.error('failed to get focus element, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -215,14 +215,14 @@ let focusElement; ...@@ -215,14 +215,14 @@ let focusElement;
try { try {
axContext.getFocusElement((err, data) => { axContext.getFocusElement((err, data) => {
if (err) { if (err) {
console.error('failed to get focus element, because ' + JSON.stringify(err)); console.error('failed to get focus element, because ${JSON.stringify(err)}');
return; return;
} }
focusElement = data; focusElement = data;
console.info('get focus element success'); console.info('get focus element success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get focus element, because ' + JSON.stringify(exception)); console.error('failed to get focus element, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -249,14 +249,14 @@ let isAccessibilityFocus = true; ...@@ -249,14 +249,14 @@ let isAccessibilityFocus = true;
try { try {
axContext.getFocusElement(isAccessibilityFocus, (err, data) => { axContext.getFocusElement(isAccessibilityFocus, (err, data) => {
if (err) { if (err) {
console.error('failed to get focus element, because ' + JSON.stringify(err)); console.error('failed to get focus element, because ${JSON.stringify(err)}');
return; return;
} }
focusElement = data; focusElement = data;
console.info('get focus element success'); console.info('get focus element success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get focus element, because ' + JSON.stringify(exception)); console.error('failed to get focus element, because ${JSON.stringify(exception)}');
} }
``` ```
## AccessibilityExtensionContext.getWindowRootElement ## AccessibilityExtensionContext.getWindowRootElement
...@@ -296,10 +296,10 @@ try { ...@@ -296,10 +296,10 @@ try {
rootElement = data; rootElement = data;
console.log('get root element of the window success'); console.log('get root element of the window success');
}).catch((err) => { }).catch((err) => {
console.error('failed to get root element of the window, because ' + JSON.stringify(err)); console.error('failed to get root element of the window, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get root element of the window, ' + JSON.stringify(exception)); console.error('failed to get root element of the window, ${JSON.stringify(exception)}');
} }
``` ```
...@@ -332,14 +332,14 @@ let rootElement; ...@@ -332,14 +332,14 @@ let rootElement;
try { try {
axContext.getWindowRootElement((err, data) => { axContext.getWindowRootElement((err, data) => {
if (err) { if (err) {
console.error('failed to get root element of the window, because ' + JSON.stringify(err)); console.error('failed to get root element of the window, because ${JSON.stringify(err)}');
return; return;
} }
rootElement = data; rootElement = data;
console.info('get root element of the window success'); console.info('get root element of the window success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get root element of the window, because ' + JSON.stringify(exception)); console.error('failed to get root element of the window, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -374,14 +374,14 @@ let windowId = 10; ...@@ -374,14 +374,14 @@ let windowId = 10;
try { try {
axContext.getWindowRootElement(windowId, (err, data) => { axContext.getWindowRootElement(windowId, (err, data) => {
if (err) { if (err) {
console.error('failed to get root element of the window, because ' + JSON.stringify(err)); console.error('failed to get root element of the window, because ${JSON.stringify(err)}');
return; return;
} }
rootElement = data; rootElement = data;
console.info('get root element of the window success'); console.info('get root element of the window success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get root element of the window, because ' + JSON.stringify(exception)); console.error('failed to get root element of the window, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -422,10 +422,10 @@ try { ...@@ -422,10 +422,10 @@ try {
windows = data; windows = data;
console.log('get windows success'); console.log('get windows success');
}).catch((err) => { }).catch((err) => {
console.error('failed to get windows, because ' + JSON.stringify(err)); console.error('failed to get windows, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get windows, because ' + JSON.stringify(exception)); console.error('failed to get windows, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -458,14 +458,14 @@ let windows; ...@@ -458,14 +458,14 @@ let windows;
try { try {
axContext.getWindows((err, data) => { axContext.getWindows((err, data) => {
if (err) { if (err) {
console.error('failed to get windows, because ' + JSON.stringify(err)); console.error('failed to get windows, because ${JSON.stringify(err)}');
return; return;
} }
windows = data; windows = data;
console.info('get windows success'); console.info('get windows success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get windows, because ' + JSON.stringify(exception)); console.error('failed to get windows, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -500,14 +500,14 @@ let displayId = 10; ...@@ -500,14 +500,14 @@ let displayId = 10;
try { try {
axContext.getWindows(displayId, (err, data) => { axContext.getWindows(displayId, (err, data) => {
if (err) { if (err) {
console.error('failed to get windows, because ' + JSON.stringify(err)); console.error('failed to get windows, because ${JSON.stringify(err)}');
return; return;
} }
windows = data; windows = data;
console.info('get windows success'); console.info('get windows success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to get windows, because ' + JSON.stringify(exception)); console.error('failed to get windows, because ${JSON.stringify(exception)}');
} }
``` ```
...@@ -542,7 +542,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes ...@@ -542,7 +542,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes
**Example** **Example**
```ts ```ts
import GesturePath from "@ohos.accessibility.GesturePath"; import GesturePath from '@ohos.accessibility.GesturePath';
import GesturePoint from '@ohos.accessibility.GesturePoint'; import GesturePoint from '@ohos.accessibility.GesturePoint';
let gesturePath = new GesturePath.GesturePath(100); let gesturePath = new GesturePath.GesturePath(100);
try { try {
...@@ -553,10 +553,10 @@ try { ...@@ -553,10 +553,10 @@ try {
axContext.injectGesture(gesturePath).then(() => { axContext.injectGesture(gesturePath).then(() => {
console.info('inject gesture success'); console.info('inject gesture success');
}).catch((err) => { }).catch((err) => {
console.error('failed to inject gesture, because ' + JSON.stringify(err)); console.error('failed to inject gesture, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to inject gesture, because ' + JSON.stringify(exception)); console.error('failed to inject gesture, because ${JSON.stringify(exception)}');
} }
``` ```
## AccessibilityExtensionContext.injectGesture ## AccessibilityExtensionContext.injectGesture
...@@ -585,7 +585,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes ...@@ -585,7 +585,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes
**Example** **Example**
```ts ```ts
import GesturePath from "@ohos.accessibility.GesturePath"; import GesturePath from '@ohos.accessibility.GesturePath';
import GesturePoint from '@ohos.accessibility.GesturePoint'; import GesturePoint from '@ohos.accessibility.GesturePoint';
let gesturePath = new GesturePath.GesturePath(100); let gesturePath = new GesturePath.GesturePath(100);
try { try {
...@@ -595,13 +595,13 @@ try { ...@@ -595,13 +595,13 @@ try {
} }
axContext.injectGesture(gesturePath, (err, data) => { axContext.injectGesture(gesturePath, (err, data) => {
if (err) { if (err) {
console.error('failed to inject gesture, because ' + JSON.stringify(err)); console.error('failed to inject gesture, because ${JSON.stringify(err)}');
return; return;
} }
console.info('inject gesture success'); console.info('inject gesture success');
}); });
} catch (exception) { } catch (exception) {
console.error('failed to inject gesture, because ' + JSON.stringify(exception)); console.error('failed to inject gesture, because ${JSON.stringify(exception)}');
} }
``` ```
## AccessibilityElement<sup>9+</sup> ## AccessibilityElement<sup>9+</sup>
...@@ -633,7 +633,7 @@ rootElement.attributeNames().then((data) => { ...@@ -633,7 +633,7 @@ rootElement.attributeNames().then((data) => {
console.log('get attribute names success'); console.log('get attribute names success');
attributeNames = data; attributeNames = data;
}).catch((err) => { }).catch((err) => {
console.log('failed to get attribute names, because ' + JSON.stringify(err)); console.log('failed to get attribute names, because ${JSON.stringify(err)}');
}); });
``` ```
## attributeNames ## attributeNames
...@@ -657,7 +657,7 @@ let rootElement; ...@@ -657,7 +657,7 @@ let rootElement;
let attributeNames; let attributeNames;
rootElement.attributeNames((err, data) => { rootElement.attributeNames((err, data) => {
if (err) { if (err) {
console.error('failed to get attribute names, because ' + JSON.stringify(err)); console.error('failed to get attribute names, because ${JSON.stringify(err)}');
return; return;
} }
attributeNames = data; attributeNames = data;
...@@ -703,10 +703,10 @@ try { ...@@ -703,10 +703,10 @@ try {
console.log('get attribute value by name success'); console.log('get attribute value by name success');
attributeValue = data; attributeValue = data;
}).catch((err) => { }).catch((err) => {
console.log('failed to get attribute value, because ' + JSON.stringify(err)); console.log('failed to get attribute value, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to get attribute value, because ' + JSON.stringify(exception)); console.log('failed to get attribute value, because ${JSON.stringify(exception)}');
} }
``` ```
## AccessibilityElement.attributeValue ## AccessibilityElement.attributeValue
...@@ -742,14 +742,14 @@ let attributeName = 'name'; ...@@ -742,14 +742,14 @@ let attributeName = 'name';
try { try {
rootElement.attributeValue(attributeName, (err, data) => { rootElement.attributeValue(attributeName, (err, data) => {
if (err) { if (err) {
console.error('failed to get attribute value, because ' + JSON.stringify(err)); console.error('failed to get attribute value, because ${JSON.stringify(err)}');
return; return;
} }
attributeValue = data; attributeValue = data;
console.info('get attribute value success'); console.info('get attribute value success');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to get attribute value, because ' + JSON.stringify(exception)); console.log('failed to get attribute value, because ${JSON.stringify(exception)}');
} }
``` ```
## actionNames ## actionNames
...@@ -775,7 +775,7 @@ rootElement.actionNames().then((data) => { ...@@ -775,7 +775,7 @@ rootElement.actionNames().then((data) => {
console.log('get action names success'); console.log('get action names success');
actionNames = data; actionNames = data;
}).catch((err) => { }).catch((err) => {
console.log('failed to get action names because ' + JSON.stringify(err)); console.log('failed to get action names because ${JSON.stringify(err)}');
}); });
``` ```
## actionNames ## actionNames
...@@ -799,7 +799,7 @@ let rootElement; ...@@ -799,7 +799,7 @@ let rootElement;
let actionNames; let actionNames;
rootElement.actionNames((err, data) => { rootElement.actionNames((err, data) => {
if (err) { if (err) {
console.error('failed to get action names, because ' + JSON.stringify(err)); console.error('failed to get action names, because ${JSON.stringify(err)}');
return; return;
} }
actionNames = data; actionNames = data;
...@@ -843,10 +843,10 @@ try { ...@@ -843,10 +843,10 @@ try {
rootElement.performAction('action').then((data) => { rootElement.performAction('action').then((data) => {
console.info('perform action success'); console.info('perform action success');
}).catch((err) => { }).catch((err) => {
console.log('failed to perform action, because ' + JSON.stringify(err)); console.log('failed to perform action, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to perform action, because ' + JSON.stringify(exception)); console.log('failed to perform action, because ${JSON.stringify(exception)}');
} }
``` ```
## performAction ## performAction
...@@ -879,13 +879,13 @@ let rootElement; ...@@ -879,13 +879,13 @@ let rootElement;
try { try {
rootElement.performAction('action', (err, data) => { rootElement.performAction('action', (err, data) => {
if (err) { if (err) {
console.error('failed to perform action, because ' + JSON.stringify(err)); console.error('failed to perform action, because ${JSON.stringify(err)}');
return; return;
} }
console.info('perform action success'); console.info('perform action success');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to perform action, because ' + JSON.stringify(exception)); console.log('failed to perform action, because ${JSON.stringify(exception)}');
} }
``` ```
## performAction ## performAction
...@@ -923,13 +923,13 @@ let parameters = { ...@@ -923,13 +923,13 @@ let parameters = {
try { try {
rootElement.performAction(actionName, parameters, (err, data) => { rootElement.performAction(actionName, parameters, (err, data) => {
if (err) { if (err) {
console.error('failed to perform action, because ' + JSON.stringify(err)); console.error('failed to perform action, because ${JSON.stringify(err)}');
return; return;
} }
console.info('perform action success'); console.info('perform action success');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to perform action, because ' + JSON.stringify(exception)); console.log('failed to perform action, because ${JSON.stringify(exception)}');
} }
``` ```
## findElement('content') ## findElement('content')
...@@ -965,10 +965,10 @@ try { ...@@ -965,10 +965,10 @@ try {
elements = data; elements = data;
console.log('find element success'); console.log('find element success');
}).catch((err) => { }).catch((err) => {
console.log('failed to find element, because ' + JSON.stringify(err)); console.log('failed to find element, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to find element, because ' + JSON.stringify(exception)); console.log('failed to find element, because ${JSON.stringify(exception)}');
} }
``` ```
## findElement('content') ## findElement('content')
...@@ -997,14 +997,14 @@ let elements; ...@@ -997,14 +997,14 @@ let elements;
try { try {
rootElement.findElement(type, condition, (err, data) => { rootElement.findElement(type, condition, (err, data) => {
if (err) { if (err) {
console.error('failed to find element, because ' + JSON.stringify(err)); console.error('failed to find element, because ${JSON.stringify(err)}');
return; return;
} }
elements = data; elements = data;
console.info('find element success'); console.info('find element success');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to find element, because ' + JSON.stringify(exception)); console.log('failed to find element, because ${JSON.stringify(exception)}');
} }
``` ```
## findElement('focusType') ## findElement('focusType')
...@@ -1040,10 +1040,10 @@ try { ...@@ -1040,10 +1040,10 @@ try {
element = data; element = data;
console.log('find element success'); console.log('find element success');
}).catch((err) => { }).catch((err) => {
console.log('failed to find element, because ' + JSON.stringify(err)); console.log('failed to find element, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to find element, because ' + JSON.stringify(exception)); console.log('failed to find element, because ${JSON.stringify(exception)}');
} }
``` ```
## findElement('focusType') ## findElement('focusType')
...@@ -1072,14 +1072,14 @@ let element; ...@@ -1072,14 +1072,14 @@ let element;
try { try {
rootElement.findElement(type, condition, (err, data) => { rootElement.findElement(type, condition, (err, data) => {
if (err) { if (err) {
console.error('failed to find element, because ' + JSON.stringify(err)); console.error('failed to find element, because ${JSON.stringify(err)}');
return; return;
} }
element = data; element = data;
console.info('find element success'); console.info('find element success');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to find element, because ' + JSON.stringify(exception)); console.log('failed to find element, because ${JSON.stringify(exception)}');
} }
``` ```
## findElement('focusDirection') ## findElement('focusDirection')
...@@ -1115,10 +1115,10 @@ try { ...@@ -1115,10 +1115,10 @@ try {
element = data; element = data;
console.log('find element success'); console.log('find element success');
}).catch((err) => { }).catch((err) => {
console.log('failed to find element, because ' + JSON.stringify(err)); console.log('failed to find element, because ${JSON.stringify(err)}');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to find element, because ' + JSON.stringify(exception)); console.log('failed to find element, because ${JSON.stringify(exception)}');
} }
``` ```
## findElement('focusDirection') ## findElement('focusDirection')
...@@ -1147,13 +1147,13 @@ let elements; ...@@ -1147,13 +1147,13 @@ let elements;
try { try {
rootElement.findElement(type, condition, (err, data) => { rootElement.findElement(type, condition, (err, data) => {
if (err) { if (err) {
console.error('failed to find element, because ' + JSON.stringify(err)); console.error('failed to find element, because ${JSON.stringify(err)}');
return; return;
} }
elements = data; elements = data;
console.info('find element success'); console.info('find element success');
}); });
} catch (exception) { } catch (exception) {
console.log('failed to find element, because ' + JSON.stringify(exception)); console.log('failed to find element, because ${JSON.stringify(exception)}');
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册