diff options
author | surfdude29 <149612116+surfdude29@users.noreply.github.com> | 2024-10-14 19:47:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-14 21:47:17 +0300 |
commit | 0f40013963aaf4f3ac893ce58958ea30bc7a1efd (patch) | |
tree | 1d83dfa6337bea61649cd5c8e6043a73439a04d5 /src/lib/api | |
parent | ef5bc5243e4dff6a8e9d01116f1f8a29079e80f8 (diff) | |
download | voidsky-0f40013963aaf4f3ac893ce58958ea30bc7a1efd.tar.zst |
Translate strings in `src/lib/api/index.ts` (#5750)
Diffstat (limited to 'src/lib/api')
-rw-r--r-- | src/lib/api/index.ts | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 4b203d28b..db5c9c247 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -11,6 +11,7 @@ import { ComAtprotoRepoStrongRef, RichText, } from '@atproto/api' +import {t} from '@lingui/macro' import {QueryClient} from '@tanstack/react-query' import {isNetworkError} from '#/lib/strings/errors' @@ -52,7 +53,7 @@ export async function post( {cleanNewlines: true}, ) - opts.onStateChange?.('Processing...') + opts.onStateChange?.(t`Processing...`) await rt.detectFacets(agent) @@ -102,7 +103,7 @@ export async function post( let res try { - opts.onStateChange?.('Posting...') + opts.onStateChange?.(t`Posting...`) res = await agent.post({ text: rt.text, facets: rt.facets, @@ -117,7 +118,7 @@ export async function post( }) if (isNetworkError(e)) { throw new Error( - 'Post failed to upload. Please check your Internet connection and try again.', + t`Post failed to upload. Please check your Internet connection and try again.`, ) } else { throw e @@ -141,7 +142,7 @@ export async function post( safeMessage: e.message, }) throw new Error( - 'Failed to save post interaction settings. Your post was created but users may be able to interact with it.', + t`Failed to save post interaction settings. Your post was created but users may be able to interact with it.`, ) } } @@ -166,7 +167,7 @@ export async function post( safeMessage: e.message, }) throw new Error( - 'Failed to save post interaction settings. Your post was created but users may be able to interact with it.', + t`Failed to save post interaction settings. Your post was created but users may be able to interact with it.`, ) } } @@ -248,7 +249,7 @@ async function resolveMedia( logger.debug(`Uploading images`, { count: imagesDraft.length, }) - onStateChange?.(`Uploading images...`) + onStateChange?.(t`Uploading images...`) const images: AppBskyEmbedImages.Image[] = await Promise.all( imagesDraft.map(async (image, i) => { logger.debug(`Compressing image #${i}`) @@ -302,7 +303,7 @@ async function resolveMedia( ) let blob: BlobRef | undefined if (resolvedGif.thumb) { - onStateChange?.('Uploading link thumbnail...') + onStateChange?.(t`Uploading link thumbnail...`) const {path, mime} = resolvedGif.thumb.source const response = await uploadBlob(agent, path, mime) blob = response.data.blob @@ -326,7 +327,7 @@ async function resolveMedia( if (resolvedLink.type === 'external') { let blob: BlobRef | undefined if (resolvedLink.thumb) { - onStateChange?.('Uploading link thumbnail...') + onStateChange?.(t`Uploading link thumbnail...`) const {path, mime} = resolvedLink.thumb.source const response = await uploadBlob(agent, path, mime) blob = response.data.blob @@ -352,7 +353,7 @@ async function resolveRecord( ): Promise<ComAtprotoRepoStrongRef.Main> { const resolvedLink = await fetchResolveLinkQuery(queryClient, agent, uri) if (resolvedLink.type !== 'record') { - throw Error('Expected uri to resolve to a record') + throw Error(t`Expected uri to resolve to a record`) } return resolvedLink.record } |