open-index/open-npm huggingface dataset:
npm package: @fransekman/next-i18n
Description: A simple i18n library for Next.js
Author: Frans Ekman
Latest version: 0.2.0

# @fransekman/store

## Setup

```bash
npm install @fransekman/next-i18n
```

```ts
// middleware.ts
import { i18nMiddleware } from "@fransekman/next-i18n";

export default i18nMiddleware({
    locales: ["en", "sv", "es", "fr"] as const,
    default: "en",
});
```

```
src/
|-- app/
|   |-- [locale]/
|   |   |-- layout.tsx
|   |   |-- page.tsx
|-- middleware.ts
```

## locale()

Returns the current locale on the server.

## useLocale()

Returns the current locale on the client.