Skip to content

Bump rust-i18n from 3.1.5 to 4.0.0#175

Open
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/cargo/rust-i18n-4.0.0
Open

Bump rust-i18n from 3.1.5 to 4.0.0#175
dependabot[bot] wants to merge 1 commit intomainfrom
dependabot/cargo/rust-i18n-4.0.0

Conversation

@dependabot
Copy link
Copy Markdown
Contributor

@dependabot dependabot Bot commented on behalf of github Apr 22, 2026

Bumps rust-i18n from 3.1.5 to 4.0.0.

Release notes

Sourced from rust-i18n's releases.

v4.0.0

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

... (truncated)

Commits
  • a931914 Version 4.0.0
  • 410adde Reduce allocations create unnecessary HashMaps and Strings (#133)
  • 94a91a7 docs: Update user cases. (#134)
  • 90b8e37 Bump slab from 0.4.10 to 0.4.11 (#122)
  • c58ecb6 Bump v4.0.0-preview1
  • 2d09179 Add messages_for_locale method to get all message for locale to Backend. (#...
  • 1cc7772 Add try_load_locales method to rust-i18n-support. (#127)
  • e6d6170 chore: Remove once_cell, use std::sync::LazyLock. (#131)
  • 8e7fb82 Bump v4.0.0-preview0 (#130)
  • 0ce74a8 Convert Backend's &str to Cow instead (#114)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [rust-i18n](https://github.com/longbridge/rust-i18n) from 3.1.5 to 4.0.0.
- [Release notes](https://github.com/longbridge/rust-i18n/releases)
- [Commits](longbridge/rust-i18n@v3.1.5...v4.0.0)

---
updated-dependencies:
- dependency-name: rust-i18n
  dependency-version: 4.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file rust Pull requests that update rust code labels Apr 22, 2026
@dependabot dependabot Bot requested a review from Tuntii as a code owner April 22, 2026 08:30
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file rust Pull requests that update rust code labels Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants