Dachshund Mascot

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

Installation

gleam add dachshund

Usage

1. Write Translations

Create translation modules for each locale:

// 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:

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:

import translations/en as t

pub fn render() -> String {
  t.welcome  // "Welcome to Dachshund!"
}

Why Dachshund?

License

MIT

✨ Search Document