rustauth-i18n
Internationalization plugin for RustAuth.
What It Is
rustauth-i18n localizes RustAuth JSON error responses. It detects a locale,
looks up the response code in your dictionaries, replaces message, and
preserves the original message as originalMessage.
What It Provides
- Translation dictionaries keyed by RustAuth error code.
- Locale detection from
Accept-Language, cookies, session fields, or sync/async resolver callbacks. - Fallback locale handling.
- A server-side plugin that can be registered with
RustAuth::builder().
Quick Start
use ;
use RustAuth;
let auth = builder
.secret
.plugin
.build?;
# let _ = auth;
# Ok::
Notes
- For migrations from an existing
IndexMapof locale tables, useI18nOptions::from_translations(map)instead of building dictionaries by hand. Accept-Languagetries exact tags before base tags, for examplept-BRbeforept.- Cookie detection defaults to the
localecookie. - Session detection defaults to a user/session
localefield. - Async locale callbacks use
get_locale_asyncand requireAuthRouter::handle_async(or the RustAuth async server path). SyncAuthRouter::handlekeeps synchronousget_localeonly.
Status
Experimental beta. Locale detection, translation keys, and plugin behavior may change before stable release.
Better Auth compatibility
Server-side i18n plugin that localizes JSON error responses by error code.
Aligned with Better Auth 1.6.9 where it matters; RustAuth is not a line-by-line port.
For route-level parity, test counts, intentional differences, and known gaps, see UPSTREAM.md.