
# Dachshund
**A Gleam i18n library inspired by Paraglide β Translations as Code**
Dachshund is a type-safe internationalization (i18n) library for Gleam. It treats translations as first-class Gleam code, giving you compile-time safety, autocomplete, and refactoring support for your multilingual applications.
## Features
- π **Zero Dependencies** β Nothing. Not even a leash. Pure Gleam all the way down.
- π― **Strategy-Based Detection** β Cookie, localStorage, URL, browser language β all in Gleam.
- π **Type Safety** β The compiler catches bugs before your users do.
## Installation
```bash
gleam add dachshund
```
## Usage
### 1. Write Translations
Create translation modules for each locale:
```gleam
// translations/en.gleam
pub const welcome = "Welcome to Dachshund!"
pub const goodbye = "Goodbye"
// translations/de.gleam
pub const welcome = "Willkommen bei Dachshund!"
pub const goodbye = "Auf Wiedersehen"
// translations/zh_cn.gleam
pub const welcome = "ζ¬’θΏδ½Ώη¨ Dachshund!"
pub const goodbye = "εθ§"
```
### 2. Detect Locale
Use strategies to detect the user's preferred language:
```gleam
import dachshund/strategy
const my_strategy = [
strategy.local_storage("locale"),
strategy.preferred_language(),
strategy.base_locale(translations.En),
]
```
### 3. Import & Use
Import the correct module based on locale and use like any value:
```gleam
import translations/en as t
pub fn render() -> String {
t.welcome // "Welcome to Dachshund!"
}
```
## Why Dachshund?
- **No runtime lookups** β Translations are compiled into your code
- **No missing keys** β The compiler ensures all translations exist
- **No typos** β Use Gleam's type system, not string keys
- **IDE support** β Get autocomplete and go-to-definition for free
## License
MIT