Skip to content

Releases

v4.2.4

Choose a tag to compare

@huacnlee huacnlee released this 29 Sep 03:17

What's Changed

  • Pack i18n translations into one literal per locale by @nickpresta in #148

New Contributors

Full Changelog: v4.2.3...v4.2.4

v4.2.3

Choose a tag to compare

@huacnlee huacnlee released this 27 Sep 09:37

What's Changed

  • Speed up translation lookup, locale access and argument interpolation by @huacnlee in #150
  • Cache the current locale per thread and hash backend keys with foldhash by @huacnlee in #151

Full Changelog: v4.2.2...v4.2.3

v4.2.2

Choose a tag to compare

@huacnlee huacnlee released this 08 Sep 03:42

What's Changed

  • Bump serde-saphyr to 1.2 to fix smallvec version conflict by @huacnlee in #147

Full Changelog: v4.2.1...v4.2.2

v4.2.1

Choose a tag to compare

@huacnlee huacnlee released this 16 Jul 11:31

What's Changed

  • Use serde-saphyr for YAML parsing by @huacnlee with @Copilot in #144

Full Changelog: v4.2.0...v4.2.1

v4.2.0

Choose a tag to compare

@huacnlee huacnlee released this 13 Jul 07:22

What's Changed

  • Add extend! macro to extend crate's translations by @huacnlee in #143

Full Changelog: v4.1.0...v4.2.0

v4.1.0

Choose a tag to compare

@huacnlee huacnlee released this 28 May 03:27
97cf091

What's Changed

  • fix: enable codegen feature for rust-i18n-support in dev-dependencies by @sunli829 in #141

Full Changelog: v4.0.0...v4.1.0

v4.0.0

Choose a tag to compare

@huacnlee huacnlee released this 11 Apr 13:06

What's Changed

Breaking Changes

  • Backend trait signature changed to use Cow<'_, str> β€” available_locales() now returns Vec<Cow<'_, str>> instead of Vec<&str>, and translate() now returns Option<Cow<'_, str>> instead of Option<&str>. Custom Backend implementations must be updated accordingly. (#114)
  • SimpleBackend::add_translations() signature changed β€” Now takes Cow<'static, str> for locale and HashMap<Cow<'static, str>, Cow<'static, str>> for data, instead of &str and &HashMap<&str, &str>. (#133)
  • New required method messages_for_locale on Backend trait β€” Returns all translation messages for a given locale as Option<Vec<(Cow<'_, str>, Cow<'_, str>)>>.
  • Removed once_cell dependency β€” Replaced with std::sync::LazyLock from the standard library. The re-export rust_i18n::once_cell is no longer available. This raises the minimum supported Rust version (MSRV) to 1.80.0. (#131)

Performance Improvements

  • Dramatically reduced allocations in the i18n! macro expansion β€” Previously, the macro generated one HashMap per translation pair; now it generates one HashMap per locale. For large projects, this reduces HashMap creation from thousands to just a handful (e.g., 14,000 β†’ 32). This also fixes stack overflow crashes on Windows for projects with many translations. (#133)
  • Eliminated unnecessary String allocations β€” By using Cow<'static, str> throughout, static translation strings are no longer cloned into heap-allocated Strings. (#114, #133)

New Features

  • messages_for_locale() method on Backend β€” Retrieve all translation key-value pairs for a specific locale, useful for inspection and debugging.
  • try_load_locales() function β€” A fallible alternative to load_locales() in rust-i18n-support that returns Result instead of panicking, with detailed error messages for file lookup, parsing, and I/O failures. (#127)
  • Improved error messages β€” Parsing failures now include the specific error reason instead of a generic panic message. (#116)

Internal / Maintenance

  • Replaced once_cell::sync::Lazy with std::sync::LazyLock (#131)
  • Added Cargo.lock to version control (#120)
  • Improved CI workflow with concurrency groups and branch filtering
  • Added release workflow
  • Bumped slab from 0.4.10 to 0.4.11 (#122)

Migration Guide

If you have a custom Backend implementation, update it to:

use std::borrow::Cow;

impl Backend for MyBackend {
    fn available_locales(&self) -> Vec<Cow<'_, str>> { /* ... */ }
    fn translate(&self, locale: &str, key: &str) -> Option<Cow<'_, str>> { /* ... */ }
    fn messages_for_locale(&self, locale: &str) -> Option<Vec<(Cow<'_, str>, Cow<'_, str>)>> { /* ... */ }
}

If you were using rust_i18n::once_cell, switch to std::sync::LazyLock (requires Rust 1.80+).

New Contributors

Full Changelog: v3.1.5...v4.0.0

v3.1.5

Choose a tag to compare

@huacnlee huacnlee released this 22 May 11:50

What's Changed

  • Add parsing of workspace.metadata.i18n by @litcc in #93
  • Fix load translations to avoid stack overflow. by @nduchaux in #112

New Contributors

Full Changelog: v3.1.4...v3.1.5

v3.1.4

Choose a tag to compare

@huacnlee huacnlee released this 01 Apr 14:08

What's Changed

Full Changelog: v3.1.3...v3.1.4

v3.1.3

Choose a tag to compare

@huacnlee huacnlee released this 20 Feb 03:04

What's Changed

  • Replace HashMap with BTreeMap to remove non-determinism in build by @ilmanzo in #104

New Contributors

Full Changelog: v3.1.2...v3.1.3