# Internationalization (https://s3.dimah.dev/docs/i18n)



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

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

export const fa = {
  "Upload failed(toast)": "آپلود ناموفق بود",
  "Cancel(dialog button)": "لغو",
} satisfies Partial<Translations>;
```

```ts title="lib/s3-client.ts"
"use client";

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

export const s3Client = createS3Client();
export const S3Provider = s3Client.Provider;
```

```tsx title="app/layout.tsx"
import { S3Provider } from "@/lib/s3-client";
import { fa } from "@/lib/translations-fa";

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="fa" dir="rtl">
      <body>
        <S3Provider translations={fa}>{children}</S3Provider>
      </body>
    </html>
  );
}
```

Vite / other all-client apps can pass `translations` on `<s3Client.Provider>` instead.

Missing keys stay English.

## API errors [#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.
