|
1 | 1 | # Translations for Brands (Beta)
|
2 | 2 |
|
3 |
| -<Callout type="info"> |
4 |
| -The Translations Admin GraphQL API is currently available on Catalyst storefronts only. |
| 3 | +<Callout type='info'> |
| 4 | + The Translations Admin GraphQL API is currently available on Catalyst |
| 5 | + storefronts only. |
5 | 6 | </Callout>
|
6 | 7 |
|
7 | 8 | The brands translatable fields are:
|
8 | 9 |
|
9 |
| -* Name |
10 |
| -* Page Title |
11 |
| -* Meta Keywords |
12 |
| -* Meta Description |
13 |
| -* Search Keywords |
| 10 | +- Name |
| 11 | +- Page Title |
| 12 | +- Meta Keywords |
| 13 | +- Meta Description |
| 14 | +- Search Keywords |
14 | 15 |
|
15 | 16 | ## Examples
|
16 | 17 |
|
17 | 18 | Below are examples of GraphQL queries and mutations for retrieving and managing translation settings for brands.
|
18 | 19 |
|
19 | 20 | ### Query translations
|
20 | 21 |
|
21 |
| -This query returns a paginated list of translations by resourceType, channel and locale with a maximum of 50 results per request. |
| 22 | +#### Query a list of translations |
| 23 | + |
| 24 | +This query returns a paginated list of translations by resourceType, channel and locale with a maximum of 50 results per request. |
22 | 25 |
|
23 | 26 | <Tabs items={['Request', 'Response']}>
|
24 | 27 | <Tab>
|
25 | 28 |
|
26 |
| -```graphql filename="Example mutation: Query a translation" showLineNumbers copy |
| 29 | +```graphql filename="Example query: Query a list of translations" showLineNumbers copy |
27 | 30 | GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql
|
28 | 31 | X-Auth-Token: {{token}}
|
29 | 32 |
|
@@ -53,54 +56,189 @@ query {
|
53 | 56 | </Tab>
|
54 | 57 | <Tab>
|
55 | 58 |
|
56 |
| -```json filename="Example query: Query a translation" showLineNumbers copy |
| 59 | +```json filename="Example query: Query a list of translations" showLineNumbers copy |
57 | 60 | {
|
58 |
| - "data": { |
59 |
| - "store": { |
60 |
| - "translations": { |
61 |
| - "edges": [ |
62 |
| - { |
63 |
| - "node": { |
64 |
| - "resourceId": "bc/store/brand/24", |
65 |
| - "fields": [ |
66 |
| - { |
67 |
| - "fieldName": "name", |
68 |
| - "original": "my channel level brands", |
69 |
| - "translation": "name (OVR) 1" |
70 |
| - }, |
71 |
| - { |
72 |
| - "fieldName": "description", |
73 |
| - "original": "<p>my channel level brands description</p>", |
74 |
| - "translation": "description (OVR)" |
75 |
| - }, |
76 |
| - { |
77 |
| - "fieldName": "page_title", |
78 |
| - "original": "Second Home page title", |
79 |
| - "translation": "page_title (OVR)" |
80 |
| - }, |
81 |
| - { |
82 |
| - "fieldName": "meta_description", |
83 |
| - "original": "Second Meta description", |
84 |
| - "translation": "meta_description (OVR)" |
85 |
| - }, |
86 |
| - { |
87 |
| - "fieldName": "meta_keywords", |
88 |
| - "original": "Second Meta Keywords", |
89 |
| - "translation": "meta keywords (OVR)" |
90 |
| - }, |
91 |
| - { |
92 |
| - "fieldName": "search_keywords", |
93 |
| - "original": "Second Search keywords", |
94 |
| - "translation": "search_keywords (OVR)" |
95 |
| - } |
96 |
| - ] |
97 |
| - }, |
98 |
| - "cursor": "eyJpZCI6MjR9" |
99 |
| - } |
100 |
| - ] |
101 |
| - } |
| 61 | + "data": { |
| 62 | + "store": { |
| 63 | + "translations": { |
| 64 | + "edges": [ |
| 65 | + { |
| 66 | + "node": { |
| 67 | + "resourceId": "bc/store/brand/24", |
| 68 | + "fields": [ |
| 69 | + { |
| 70 | + "fieldName": "name", |
| 71 | + "original": "my channel level brands", |
| 72 | + "translation": "name (OVR) 1" |
| 73 | + }, |
| 74 | + { |
| 75 | + "fieldName": "description", |
| 76 | + "original": "<p>my channel level brands description</p>", |
| 77 | + "translation": "description (OVR)" |
| 78 | + }, |
| 79 | + { |
| 80 | + "fieldName": "page_title", |
| 81 | + "original": "Second Home page title", |
| 82 | + "translation": "page_title (OVR)" |
| 83 | + }, |
| 84 | + { |
| 85 | + "fieldName": "meta_description", |
| 86 | + "original": "Second Meta description", |
| 87 | + "translation": "meta_description (OVR)" |
| 88 | + }, |
| 89 | + { |
| 90 | + "fieldName": "meta_keywords", |
| 91 | + "original": "Second Meta Keywords", |
| 92 | + "translation": "meta keywords (OVR)" |
| 93 | + }, |
| 94 | + { |
| 95 | + "fieldName": "search_keywords", |
| 96 | + "original": "Second Search keywords", |
| 97 | + "translation": "search_keywords (OVR)" |
| 98 | + } |
| 99 | + ] |
| 100 | + }, |
| 101 | + "cursor": "eyJpZCI6MjR9" |
| 102 | + } |
| 103 | + ] |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +</Tab> |
| 111 | +</Tabs> |
| 112 | + |
| 113 | +#### Query a translation by resourceId |
| 114 | + |
| 115 | +<Callout type='warning'> |
| 116 | + When querying a translation by resourceId, you must provide the full |
| 117 | + resourceId in the format `bc/store/brand/{brand_id}`. |
| 118 | +</Callout> |
| 119 | + |
| 120 | +This query returns a translation by resourceId. |
| 121 | + |
| 122 | +<Tabs items={['Request', 'Response']}> |
| 123 | +<Tab> |
| 124 | + |
| 125 | +```graphql filename="Example query: Query a translation by resource id" showLineNumbers copy |
| 126 | +GRAPHQL https://api.bigcommerce.com/stores/{{store_hash}}/graphql |
| 127 | +X-Auth-Token: {{token}} |
| 128 | + |
| 129 | +query { |
| 130 | + store { |
| 131 | + translations(filters: { |
| 132 | + resourceType: BRANDS, |
| 133 | + channelId: "bc/store/channel/2", |
| 134 | + localeId: "bc/store/locale/it", |
| 135 | + resourceIds: ["bc/store/brand/1", "bc/store/brand/2"] |
| 136 | + }) { |
| 137 | + edges { |
| 138 | + node { |
| 139 | + resourceId |
| 140 | + fields { |
| 141 | + fieldName |
| 142 | + original |
| 143 | + translation |
| 144 | + } |
| 145 | + } |
| 146 | + cursor |
| 147 | + } |
| 148 | + } |
102 | 149 | }
|
103 |
| - } |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +</Tab> |
| 154 | +<Tab> |
| 155 | + |
| 156 | +```json filename="Example query: Query a translation by resource id" showLineNumbers copy |
| 157 | +{ |
| 158 | + "data": { |
| 159 | + "store": { |
| 160 | + "translations": { |
| 161 | + "edges": [ |
| 162 | + { |
| 163 | + "node": { |
| 164 | + "resourceId": "bc/store/brand/1", |
| 165 | + "fields": [ |
| 166 | + { |
| 167 | + "fieldName": "name", |
| 168 | + "original": "my channel level brands", |
| 169 | + "translation": "name (OVR) 1" |
| 170 | + }, |
| 171 | + { |
| 172 | + "fieldName": "description", |
| 173 | + "original": "<p>my channel level brands description</p>", |
| 174 | + "translation": "description (OVR)" |
| 175 | + }, |
| 176 | + { |
| 177 | + "fieldName": "page_title", |
| 178 | + "original": "Second Home page title", |
| 179 | + "translation": "page_title (OVR)" |
| 180 | + }, |
| 181 | + { |
| 182 | + "fieldName": "meta_description", |
| 183 | + "original": "Second Meta description", |
| 184 | + "translation": "meta_description (OVR)" |
| 185 | + }, |
| 186 | + { |
| 187 | + "fieldName": "meta_keywords", |
| 188 | + "original": "Second Meta Keywords", |
| 189 | + "translation": "meta keywords (OVR)" |
| 190 | + }, |
| 191 | + { |
| 192 | + "fieldName": "search_keywords", |
| 193 | + "original": "Second Search keywords", |
| 194 | + "translation": "search_keywords (OVR)" |
| 195 | + } |
| 196 | + ] |
| 197 | + }, |
| 198 | + "cursor": "eyJpZCI6MjR9" |
| 199 | + }, |
| 200 | + { |
| 201 | + "node": { |
| 202 | + "resourceId": "bc/store/brand/2", |
| 203 | + "fields": [ |
| 204 | + { |
| 205 | + "fieldName": "name", |
| 206 | + "original": "my channel level brands", |
| 207 | + "translation": "name (OVR) 1" |
| 208 | + }, |
| 209 | + { |
| 210 | + "fieldName": "description", |
| 211 | + "original": "<p>my channel level brands description</p>", |
| 212 | + "translation": "description (OVR)" |
| 213 | + }, |
| 214 | + { |
| 215 | + "fieldName": "page_title", |
| 216 | + "original": "Second Home page title", |
| 217 | + "translation": "page_title (OVR)" |
| 218 | + }, |
| 219 | + { |
| 220 | + "fieldName": "meta_description", |
| 221 | + "original": "Second Meta description", |
| 222 | + "translation": "meta_description (OVR)" |
| 223 | + }, |
| 224 | + { |
| 225 | + "fieldName": "meta_keywords", |
| 226 | + "original": "Second Meta Keywords", |
| 227 | + "translation": "meta keywords (OVR)" |
| 228 | + }, |
| 229 | + { |
| 230 | + "fieldName": "search_keywords", |
| 231 | + "original": "Second Search keywords", |
| 232 | + "translation": "search_keywords (OVR)" |
| 233 | + } |
| 234 | + ] |
| 235 | + }, |
| 236 | + "cursor": "eyJpZCI6MjJ7" |
| 237 | + } |
| 238 | + ] |
| 239 | + } |
| 240 | + } |
| 241 | + } |
104 | 242 | }
|
105 | 243 | ```
|
106 | 244 |
|
@@ -177,7 +315,7 @@ mutation {
|
177 | 315 | }
|
178 | 316 | }
|
179 | 317 | }
|
180 |
| -``` |
| 318 | +```` |
181 | 319 |
|
182 | 320 | </Tab>
|
183 | 321 | </Tabs>
|
@@ -223,14 +361,14 @@ mutation {
|
223 | 361 |
|
224 | 362 | ```json filename="Example mutation: Delete a translation" showLineNumbers copy
|
225 | 363 | {
|
226 |
| - "data": { |
227 |
| - "translation": { |
228 |
| - "deleteTranslations": { |
229 |
| - "__typename": "DeleteTranslationsResult", |
230 |
| - "errors": [] |
231 |
| - } |
232 |
| - } |
233 |
| - } |
| 364 | + "data": { |
| 365 | + "translation": { |
| 366 | + "deleteTranslations": { |
| 367 | + "__typename": "DeleteTranslationsResult", |
| 368 | + "errors": [] |
| 369 | + } |
| 370 | + } |
| 371 | + } |
234 | 372 | }
|
235 | 373 | ```
|
236 | 374 |
|
|
0 commit comments