dimah-s3v0.4.1

Internationalization

English by default. Pass a partial map to localize.

English needs no setup. To localize, put a map in a file and pass it to S3Provider.

lib/translations-fa.ts
import type { Translations } from "@dimah-s3/react";

export const fa = {
  "Upload failed(toast)": "آپلود ناموفق بود",
  "Cancel(dialog button)": "لغو",
} satisfies Partial<Translations>;
components/s3-provider.tsx
"use client";

import { createS3Client } from "@dimah-s3/react";
import { fa } from "@/lib/translations-fa";

export const { api, S3Provider, useApi } = createS3Client();

export function S3ClientProvider({ children }: { children: React.ReactNode }) {
  return <S3Provider translations={fa}>{children}</S3Provider>;
}

Missing keys stay English.

API errors

The server always responds in English. With @dimah-s3/ui or the React hooks you do not need anything else — the same translations map localizes those messages.

On this page