langweave 0.0.2

A Rust library for seamless internationalization (i18n) and localization.
Documentation

LangWeave

Detect text languages. Translate between language pairs. Build internationalized Rust applications.

Made With Love Crates.io lib.rs Docs.rs Codecov Build Status GitHub

WebsiteDocumentationReport BugRequest FeatureContributing Guidelines

Status

Experimental — This library is under active development. API may change in future versions.

Version Status Notes
0.0.x Experimental API subject to change
0.1.x Beta (planned) API stabilization
1.0.x Stable (planned) Stable API, semver guarantees

Features

  • Language Detection — Identify text languages across 15 supported languages including English, French, German, Spanish, Portuguese, Italian, Dutch, Russian, Arabic, Hebrew, Hindi, Japanese, Korean, Chinese, and Indonesian
  • Translation Engine — Translate between supported language pairs
  • Error Handling — Comprehensive error types for robust applications
  • Async Support — Non-blocking language detection and translation
  • Simple API — Easy-to-use functions for common tasks
  • Safety — Built with #![forbid(unsafe_code)] in library code

Installation

Add to Cargo.toml:

[dependencies]
langweave = "0.0.2"

Requirements

  • MSRV: Rust 1.87.0 or later

Feature Flags

Feature Description Default
default No optional features enabled
async Enable async utilities for non-blocking operations

Enable features in Cargo.toml:

[dependencies]
langweave = { version = "0.0.2", features = ["async"] }

Quick Start

Detect language and translate text:

use langweave::{detect_language, translate};
use langweave::error::I18nError;

fn main() -> Result<(), I18nError> {
    // Detect language using the high-level API
    let lang = detect_language("Hello, world!")?;
    println!("Detected: {}", lang);

    // Translate text
    let translated = translate("fr", "Hello")?;
    println!("Translated: {}", translated);

    Ok(())
}

Examples

Run examples:

cargo run --example <example_name>

Known Limitations

  • Short text detection — Very short texts (< 10 characters) may not have enough signal for accurate language detection
  • Mixed-language content — Text containing multiple languages may only detect the dominant language
  • Romanized scripts — Languages written in non-native scripts (e.g., Japanese in romaji) may not be detected correctly
  • Translation coverage — Not all phrases have translations; the library falls back to the original text for unknown keys

Documentation

Browse complete API reference at docs.rs/langweave.

Contributing

Read Contributing Guidelines before submitting changes.

License

Choose either Apache 2.0 or MIT license.


🎨 Designed by Sebastien Rousseau — https://sebastienrousseau.com/ 🚀 Engineered with Euxis — Enterprise Unified eXecution Intelligence System — https://euxis.co/