> ## Documentation Index
> Fetch the complete documentation index at: https://humain.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Language support

> Send a preferred language with every session and display the EU AI Act disclosure text.

## Overview

You can tell the server which language a session should use by passing a BCP-47 code as
`preferred_language` when you open the session.

> [!WARNING]
>
> **Language-keyed personas currently apply to voice sessions only.** If a kiosk has
> `language_personas` configured, a **voice** session picks the matching persona for
> `preferred_language` (falling back to the kiosk's default persona if no match). A **text**
> session always uses the kiosk's single default persona, regardless of `preferred_language` —
> language-persona selection is not yet wired into the text turn pipeline.

`preferred_language` is echoed back as `detected_language` in the session-open response — the
server does not perform real language detection today.

***

## Session open contract

**POST** `/v1/sessions`

```json theme={null}
{
  "mode": "text",
  "preferred_language": "tr"
}
```

`preferred_language` is optional — omit it entirely to use the kiosk's default persona/language.

**Response (201)**:

```json theme={null}
{
  "session_id": "sess_…",
  "agent_url": "https://api.humain.ai",
  "detected_language": "tr"
}
```

> [!NOTE]
>
> A `disclosure_text` field (an EU AI Act disclosure string) is planned for a future release but
> is **not populated by the server today** — it is always omitted from the response. The SDK and
> widget code below that reads `disclosureText` / `disclosure_text` is forward-compatible and
> currently a no-op: it will start rendering the moment the backend populates the field, but
> don't build a launch-blocking UI around it yet.

***

## JavaScript / TypeScript SDK

```typescript theme={null}
import { HumainKioskClient } from '@humain/kiosk-js'

const client = new HumainKioskClient({ credential: process.env.HUMAIN_CREDENTIAL! })

const session = await client.openSession({ preferredLanguage: 'tr' })

// Display the disclosure text before showing the chat UI
if (session.disclosureText) {
  showDisclosureBanner(session.disclosureText)
}
```

### Widget — automatic language selector

```html theme={null}
<script src="https://cdn.humain.ai/widget.js"></script>
<script>
HumainWidget.init({
  credential: 'hk_live_…',
  languageSelector: {
    enabled: true,
    languages: [
      { code: 'en', label: 'English' },
      { code: 'tr', label: 'Türkçe'  },
      { code: 'ar', label: 'العربية' },
      { code: 'de', label: 'Deutsch' },
    ],
  },
  showDisclosure: true,   // default: true
})
</script>
```

When `languageSelector.enabled` is `true`, the widget shows language buttons before the first message is sent. The chosen language is passed to `openSession` automatically and the disclosure banner (if any) is shown immediately after the session opens.

### React

```tsx theme={null}
import { KioskChat } from '@humain/kiosk-js/react'

export function SupportChat() {
  return (
    <KioskChat
      credential={process.env.NEXT_PUBLIC_HUMAIN_CREDENTIAL!}
      showLanguageSelector={{
        languages: [
          { code: 'en', label: 'English' },
          { code: 'tr', label: 'Türkçe'  },
        ],
      }}
      showDisclosure={true}
    />
  )
}
```

### Vue

```vue theme={null}
<template>
  <KioskChat
    :credential="credential"
    :show-language-selector="{ languages }"
    :show-disclosure="true"
  />
</template>

<script setup lang="ts">
import { KioskChat } from '@humain/kiosk-js/vue'

const credential = import.meta.env.VITE_HUMAIN_CREDENTIAL
const languages  = [
  { code: 'en', label: 'English' },
  { code: 'tr', label: 'Türkçe'  },
]
</script>
```

***

## Python SDK

```python theme={null}
from humain_kiosk import HumainKioskClient

client = HumainKioskClient(credential=os.environ["HUMAIN_CREDENTIAL"])

session = client.open_session(preferred_language="tr")

if session.disclosure_text:
    print(session.disclosure_text)

with client.session(preferred_language="ar") as s:
    print(s.send("مرحباً"))
```

***

## Go SDK

```go theme={null}
package main

import (
    "context"
    "fmt"
    kiosk "github.com/humain/kiosk-go"
)

func main() {
    client, _ := kiosk.NewClient(os.Getenv("HUMAIN_CREDENTIAL"))

    session, err := client.OpenSession(context.Background(), kiosk.SessionOptions{
        PreferredLanguage: "tr",
    })
    if err != nil {
        log.Fatal(err)
    }
    defer session.Close(context.Background())

    if session.DisclosureText != "" {
        fmt.Println(session.DisclosureText)
    }
}
```

***

## .NET SDK

```csharp theme={null}
using Humain.Kiosk;

var client = new KioskClient(new KioskClientOptions
{
    Credential = Environment.GetEnvironmentVariable("HUMAIN_CREDENTIAL")!,
});

await using var session = await client.OpenSessionAsync(
    mode: SessionMode.Text,
    preferredLanguage: "tr"
);

if (!string.IsNullOrEmpty(session.DisclosureText))
{
    Console.WriteLine(session.DisclosureText);
}
```

***

## C SDK

```c theme={null}
#include <kiosk.h>
#include <stdio.h>

kiosk_client_t *client = kiosk_client_create(&(kiosk_config_t){
    .credential = getenv("HUMAIN_KIOSK_CREDENTIAL"),
});

kiosk_session_config_t cfg = {0};
cfg.mode               = KIOSK_SESSION_TEXT;
cfg.preferred_language = "tr";

kiosk_session_t             *session = NULL;
kiosk_session_open_result_t  result  = {0};

kiosk_session_open(client, &cfg, &session, &result);

if (result.disclosure_text[0]) {
    puts(result.disclosure_text);
}
```

Pass `NULL` for `config` to use all defaults (text mode, no language preference).
Pass `NULL` for the result parameter if you do not need the detected language or disclosure text.

***

## WordPress plugin

In the admin panel, go to **Settings → Humain Kiosk → Language** and choose one of:

| Mode | Behaviour |
| - | - |
| **Auto-detect** | Uses the visitor's `navigator.language` (browser default) |
| **Fixed language** | Always sends the BCP-47 code you enter |
| **Language selector** | Shows language buttons before the first message |

The **AI disclosure** checkbox controls whether the disclosure banner is shown to visitors. The text itself is configured in your kiosk settings on the Humain admin panel — note `disclosure_text` is not yet populated by the server (see the note above), so this banner will not render until that ships.

***

## Admin panel — configuring language personas

A kiosk can define a **language persona** per BCP-47 code under **Kiosk → Personas**:

1. Open **Kiosk → Personas** and click **Add persona**.
2. Set the **Language** field to a BCP-47 code (e.g. `tr`, `ar`, `de`).
3. Write the system prompt in that language, or use the same prompt as the default persona.
4. Save.

> [!WARNING]
>
> **This only affects voice sessions.** When a voice session opens with `preferred_language`
> set, the server looks up `language_personas[preferred_language]` and uses it if present,
> otherwise falls back to the kiosk's default persona. A **text** session ignores
> `language_personas` entirely and always uses the kiosk's default persona — sending
> `preferred_language: "tr"` on a text session does not change which persona is used, only
> the (currently cosmetic) `detected_language` echoed back.

> [!TIP]
>
> With Gemini Live, you do not need to configure per-language STT or TTS voices. The model
> handles all 90+ supported languages natively — configuring `language_personas` only changes
> which system prompt is used, not the model's ability to speak the language.

***

## Gemini Live and language support

Voice sessions run on **Gemini Live**, which natively supports 90+ languages from a single
model — no per-language STT model or TTS voice configuration is needed. The model responds in
whatever language the user speaks, independent of persona selection; `preferred_language` and
`language_personas` only control which system prompt is loaded (see the warning above).

Text sessions use the same LLM for every language and handle multilingual input without any
server-side configuration — but again, without a way to select a different persona per language
today.

***

## Behaviour reference

| Scenario | Result |
| - | - |
| `preferred_language` omitted | `detected_language` is omitted; default persona used |
| `preferred_language` sent, **voice** mode | `detected_language` echoes the code; matching `language_personas` entry used if configured, else default persona |
| `preferred_language` sent, **text** mode | `detected_language` echoes the code; default persona always used (language-persona selection not implemented for text) |

> [!NOTE]
>
> The `preferred_language` field has no effect on which persona a text session uses. `detected_language` is always just an echo of what you sent, not a real detection result.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.