Skip to content

Commit 70a505b

Browse files
authored
Merge pull request #277060 from cristobal-buenrostro/cristobalb/ir/preferences-datatypes
IR onPreferencesChanged - describe types
2 parents 4114453 + db2559a commit 70a505b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

articles/ai-services/immersive-reader/how-to-store-user-preferences.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,55 @@ const options = {
3838
ImmersiveReader.launchAsync(YOUR_TOKEN, YOUR_SUBDOMAIN, YOUR_DATA, options);
3939
```
4040

41+
### Example Preferences JSON Structure
42+
43+
Here's an example of what the `value` parameter looks like when parsed, along with the types for each field:
44+
45+
```json
46+
{
47+
"displayOptionsState": {
48+
"textSize": "number",
49+
"fontFamily": "string",
50+
"textSpacing": "number",
51+
"formattingEnabled": "boolean",
52+
"theme": "string",
53+
"themeSetByUser": "boolean",
54+
"syllabificationEnabled": "boolean",
55+
"nounHighlightingEnabled": "boolean",
56+
"nounHighlightingColor": "string",
57+
"verbHighlightingEnabled": "boolean",
58+
"verbHighlightingColor": "string",
59+
"adjectiveHighlightingEnabled": "boolean",
60+
"adjectiveHighlightingColor": "string",
61+
"adverbHighlightingEnabled": "boolean",
62+
"adverbHighlightingColor": "string",
63+
"pictureDictionaryEnabled": "boolean",
64+
"posLabelsEnabled": "boolean"
65+
},
66+
"readAloudState": {
67+
"readAloudSpeed": "number",
68+
"voice": "string"
69+
},
70+
"translationState": {
71+
"shouldTranslateWords": "boolean",
72+
"translationLanguage": "string" // encoded JSON
73+
}
74+
}
75+
```
76+
77+
And here the sample for the `translationLanguage` decoded JSON.
78+
79+
```json
80+
{
81+
"text": "string",
82+
"key": "string",
83+
"data": {
84+
"tlc": "string",
85+
"slc": "string"
86+
}
87+
}
88+
```
89+
4190
## Load user preferences
4291

4392
Pass in the user's preferences to the Immersive Reader app by using the `-preferences` option. A trivial example to store and load the user's preferences is as follows:

0 commit comments

Comments
 (0)