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

# Platform and language

> Which OS and host your app runs on, and the shell's UI language.

## Platform

```tsx theme={null}
import { usePlatform, getPlatform } from '@cskn/sdk';

const platform = usePlatform(); // null until resolved
platform?.env; // 'mobile' | 'desktop' | 'tv' | 'web'
platform?.OS;  // 'ios' | 'android' | 'mac' | 'windows' | 'linux' | 'webos' | 'tizen'

const { OS, env } = await getPlatform();
```

<ResponseField name="env" type="'mobile' | 'desktop' | 'tv' | 'web'">
  The kind of host. `web` means a plain browser with no bridge.
</ResponseField>

<ResponseField name="OS" type="string">
  The concrete operating system.
</ResponseField>

In a browser the answer is immediate, with the OS read from the user agent. In a shell it takes one round trip; if an older shell does not answer within 1.5 s, the SDK falls back to a user-agent guess. The result never changes during a session and is cached.

Inside `UIProvider`, [`useUI()`](/ui/provider#useui) has the same information synchronously.

## Language

The shell's UI language as a short code (`'en'`, `'tr'`, …). Unlike the platform, it can change while your app is open, when the user switches language in the shell.

```tsx theme={null}
import { useEffect } from 'react';
import { useLanguage } from '@cskn/sdk';
import i18n from './i18n';

function LanguageSync() {
  const language = useLanguage(); // null until resolved; updates live
  useEffect(() => {
    if (language) void i18n.changeLanguage(language);
  }, [language]);
  return null;
}
```

In a browser it is the browser's language. Without React:

| Function | Returns |
| - | - |
| `getLanguage()` | `Promise<string>` |
| `getCachedLanguage()` | The last known language, or `null` |
| `onLanguageChange(cb)` | Called on every switch; returns an unsubscribe function |


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