(lang)
| 137 | } |
| 138 | |
| 139 | async function loadRemote(lang) { |
| 140 | let { resp, result } = await request('/resource_translations_async_downloads', { |
| 141 | method: 'POST', |
| 142 | body: { |
| 143 | data: { |
| 144 | type: 'resource_translations_async_downloads', |
| 145 | attributes: { |
| 146 | mode: 'onlytranslated', |
| 147 | }, |
| 148 | relationships: { |
| 149 | language: { |
| 150 | data: { |
| 151 | id: `l:${lang}`, |
| 152 | type: 'languages', |
| 153 | }, |
| 154 | }, |
| 155 | resource: { |
| 156 | data: { |
| 157 | id: RESOURCE_ID, |
| 158 | type: 'resources', |
| 159 | }, |
| 160 | }, |
| 161 | }, |
| 162 | }, |
| 163 | }, |
| 164 | }); |
| 165 | while (!resp.redirected && ['pending', 'processing', 'succeeded'].includes(result.data.attributes.status)) { |
| 166 | await delay(500); |
| 167 | ({ resp, result } = await request(`/resource_translations_async_downloads/${result.data.id}`)); |
| 168 | } |
| 169 | if (!resp.redirected) throw { resp, result }; |
| 170 | return result; |
| 171 | } |
| 172 | |
| 173 | async function getTranslations(lang) { |
| 174 | let { result } = await request('/resource_translations', { |
no test coverage detected