# Languages

This folder contains the internationalization (i18n) setup for this package.

## Structure

```
languages/
├── en-US.json              # Default English translations (source of truth)
├── supported-languges.ts   # List of supported language codes
├── files/                  # Translated language files (e.g., de-DE.json, fr-FR.json)
│   └── .gitkeep
├── _db/                    # Translation database for change tracking (git-ignored)
│   └── .gitignore
└── README.md               # This file
```

## How It Works

- **`en-US.json`** — The master translation file. All keys are defined here in English.
- **`supported-languges.ts`** — Exports the list of supported language codes. Add new languages here when translations are available.
- **`files/`** — Contains translated JSON files for each supported language (excluding en-US). These are generated via the Unisphere CLI export/import workflow.
- **`_db/`** — Used internally by the CLI to track translation changes between exports. Do not commit.

## Adding Translations

1. Add your translation keys to `en-US.json`
2. Run `npx unisphere languages export` to generate CSV files for translators
3. After receiving translations, run `npx unisphere languages import` to update the `files/` directory
4. Add the new language code to `supported-languges.ts`

## Usage

Components in this package use translations via the `useTranslation` hook:

```typescript
import { useTranslation } from './use-translation';

const MyComponent = () => {
  const { t } = useTranslation();
  return <span>{t('myKey')}</span>;
};
```

## CLI Commands

```bash
npx unisphere languages export    # Export translations to CSV for translation services
npx unisphere languages import    # Import translated CSV files back to JSON
npx unisphere languages serve     # Serve language files during local development
npx unisphere languages bundle    # Bundle language files for distribution
```
