# Localization

Language utilities exposed to the storefront

## Switch active language

> Wraps Django’s \`set\_language\` helper to change the active UI language.\
> \
> \*\*Behaviour\*\*\
> \- Persists the selected language in session\
> \- Redirects to \`next\` parameter (defaults to homepage)\
> \- Supports AJAX clients (returns 200 without redirect when applicable)

```json
{"openapi":"3.1.0","info":{"title":"Users API - Public Endpoints","version":"1.0.0"},"tags":[{"name":"Localization","description":"Language utilities exposed to the storefront"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/i18n/setlang/":{"post":{"tags":["Localization"],"operationId":"postSetLanguage","summary":"Switch active language","description":"Wraps Django’s `set_language` helper to change the active UI language.\n\n**Behaviour**\n- Persists the selected language in session\n- Redirects to `next` parameter (defaults to homepage)\n- Supports AJAX clients (returns 200 without redirect when applicable)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetLanguageRequest"}},"multipart/form-data":{"schema":{"$ref":"#/components/schemas/SetLanguageRequest"}}}},"responses":{"200":{"description":"Language changed (AJAX fallback)"},"302":{"description":"Language changed, redirect issued","headers":{"Location":{"schema":{"type":"string"},"description":"Redirect destination"}}}}}}},"components":{"schemas":{"SetLanguageRequest":{"type":"object","description":"Form payload used by `set_language`","required":["language"],"properties":{"language":{"type":"string","description":"Language code defined in Django `LANGUAGES`"},"next":{"anyOf":[{"type":"string"}],"description":"Optional redirect path after switching language"}}}}}}
```

## List active and available languages

> Returns the active language, default language, and available language map\
> sourced from Django settings.

```json
{"openapi":"3.1.0","info":{"title":"Users API - Public Endpoints","version":"1.0.0"},"tags":[{"name":"Localization","description":"Language utilities exposed to the storefront"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}}],"paths":{"/languages/":{"get":{"tags":["Localization"],"operationId":"getLanguages","summary":"List active and available languages","description":"Returns the active language, default language, and available language map\nsourced from Django settings.","responses":{"200":{"description":"Languages listed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LanguageListResponse"}}}}}}}},"components":{"schemas":{"LanguageListResponse":{"type":"object","description":"Available language information","required":["active_language","default_language","available_languages"],"properties":{"active_language":{"type":"string","description":"Language currently active in session"},"default_language":{"type":"string","description":"Project default language"},"available_languages":{"type":"object","description":"Mapping of language code to human-readable name","additionalProperties":{"type":"string"}}}}}}}
```


---

# 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://apidocs.akinon.com/commerce-openapis/users/module-1/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.
