# Localization

<figure><img src="/files/6d2sLWSMY8DQW06D9nrB" alt="" width="311"><figcaption></figcaption></figure>

Localization (i18n) is implemented using [Next-intl](https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing) library. Out of the box `en` and `de` are implemented as examples, together with `<LocaleSwitcher>` component.

### **Locales**

Locales can be set and configured in the `i18n/config.ts` file.

### **Locales in URL's**

Currently default locale is hidden from url, only any additional locales will be visible in the url.

* `en` *will not* be shown in url -> website.com/members
* `de` *will be* shown in url -> website.com/de/members

Showing default locale in the URL can be controlled through `i18n/routing.ts` file with option of `localePrefix` set to `always` or `as-needed`. Additionally, you will need to comment out rewriting in `middleware.ts`. Then your default locale will be shown in the url.\
\
For more info and options check the official documentation: <https://next-intl.dev/docs/getting-started/app-router/with-i18n-routing>

### **Using locales**

You define translations inside `i18n/messages`. Afterwards you can access them through a hook `useTranslations(<namespace>)`. See example on the "Homepage" when running the app.

### **Linking and navigating**

To ensure proper navigation remember to use `<Link>` component from `i18n/routing` rather then the `next/link`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://accelerator.gitbook.io/docs/features/localization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
