Bluesky app fork with some witchin' additions 💫

Translate strings in `src/lib/api/index.ts` (#5750)

authored by

surfdude29 and committed by
GitHub
0f400139 ef5bc524

+10 -9
+10 -9
src/lib/api/index.ts
··· 11 11 ComAtprotoRepoStrongRef, 12 12 RichText, 13 13 } from '@atproto/api' 14 + import {t} from '@lingui/macro' 14 15 import {QueryClient} from '@tanstack/react-query' 15 16 16 17 import {isNetworkError} from '#/lib/strings/errors' ··· 52 53 {cleanNewlines: true}, 53 54 ) 54 55 55 - opts.onStateChange?.('Processing...') 56 + opts.onStateChange?.(t`Processing...`) 56 57 57 58 await rt.detectFacets(agent) 58 59 ··· 102 103 103 104 let res 104 105 try { 105 - opts.onStateChange?.('Posting...') 106 + opts.onStateChange?.(t`Posting...`) 106 107 res = await agent.post({ 107 108 text: rt.text, 108 109 facets: rt.facets, ··· 117 118 }) 118 119 if (isNetworkError(e)) { 119 120 throw new Error( 120 - 'Post failed to upload. Please check your Internet connection and try again.', 121 + t`Post failed to upload. Please check your Internet connection and try again.`, 121 122 ) 122 123 } else { 123 124 throw e ··· 141 142 safeMessage: e.message, 142 143 }) 143 144 throw new Error( 144 - 'Failed to save post interaction settings. Your post was created but users may be able to interact with it.', 145 + t`Failed to save post interaction settings. Your post was created but users may be able to interact with it.`, 145 146 ) 146 147 } 147 148 } ··· 166 167 safeMessage: e.message, 167 168 }) 168 169 throw new Error( 169 - 'Failed to save post interaction settings. Your post was created but users may be able to interact with it.', 170 + t`Failed to save post interaction settings. Your post was created but users may be able to interact with it.`, 170 171 ) 171 172 } 172 173 } ··· 248 249 logger.debug(`Uploading images`, { 249 250 count: imagesDraft.length, 250 251 }) 251 - onStateChange?.(`Uploading images...`) 252 + onStateChange?.(t`Uploading images...`) 252 253 const images: AppBskyEmbedImages.Image[] = await Promise.all( 253 254 imagesDraft.map(async (image, i) => { 254 255 logger.debug(`Compressing image #${i}`) ··· 302 303 ) 303 304 let blob: BlobRef | undefined 304 305 if (resolvedGif.thumb) { 305 - onStateChange?.('Uploading link thumbnail...') 306 + onStateChange?.(t`Uploading link thumbnail...`) 306 307 const {path, mime} = resolvedGif.thumb.source 307 308 const response = await uploadBlob(agent, path, mime) 308 309 blob = response.data.blob ··· 326 327 if (resolvedLink.type === 'external') { 327 328 let blob: BlobRef | undefined 328 329 if (resolvedLink.thumb) { 329 - onStateChange?.('Uploading link thumbnail...') 330 + onStateChange?.(t`Uploading link thumbnail...`) 330 331 const {path, mime} = resolvedLink.thumb.source 331 332 const response = await uploadBlob(agent, path, mime) 332 333 blob = response.data.blob ··· 352 353 ): Promise<ComAtprotoRepoStrongRef.Main> { 353 354 const resolvedLink = await fetchResolveLinkQuery(queryClient, agent, uri) 354 355 if (resolvedLink.type !== 'record') { 355 - throw Error('Expected uri to resolve to a record') 356 + throw Error(t`Expected uri to resolve to a record`) 356 357 } 357 358 return resolvedLink.record 358 359 }