API reference

Rust API

Where each part of the i18n-next and tauri-plugin-i18n-next API is documented on docs.rs.

Every item is documented on docs.rs with an example. This page maps the parts to the guides.

i18n-next

docs.rs/i18n-next

ItemWhatGuide
I18n::builder()sources (dir, lazy_dir, files, lazy_files, messages, remote, extend), config / config_json, locale, fallback, fallback_for, iso, missing, pages, page_alias, evict_pages, pin_page, linked_messages, formats, datetime_formats, time_zone, clock, then build or installLoading, Locale files
I18nt (&str, the key on a miss), t_with, tc, tc_with (String), get (Option<&str>), has, text, page, with_locale, set_locale, locale, locales, pages, has_locale, has_page, add_messages, add_file, missing_files, ensure_async, reload, subscribe, version, check, tn, td, tdr, language_name, set_system_time_zone, watch (feature watch)Translating
Viewan instance bound to a page and a locale: the same lookups as I18nTranslating
Textthe lazy translated value: arg, args, count, or, page, locale, html, hide_if_empty, plural_rule, number, date, relative, resolve, write_to, fold, partsText, Rich text
Args, Argborrowed parameters for t_with / tc_with, one argument valueParameters
t!, tc!, tn!, td!, tdr!, key!, Keymacros and const keys over the implicit instance (feature global)Global access and scope
install, global, t, set_locale, locale, page, tn, td, tdr, scope, negotiatethe global instance, a locale / page / instance per request or task, Accept-Language negotiationGlobal access and scope
Number, Timestamp, RelativeOptions, Countvalues for formats and pluralsFormats, Plurals
Change, Subscriptionwhat subscribe reports, and the handle that ends itLoading
CheckReport, CheckItem, LinkErrorthe result of check()Checks
LocaleInfoone entry of locales(): code, iso, dir, display_namei18n.json
Errorevery error, #[non_exhaustive]
payloadfeature payload: the front-end payload (encode, chunk, bundle, meta for the plugin; builder, apply for a Rust guest)
tauri_guestfeature tauri-guest, wasm32-unknown-unknown only: connect, set_page, set_locale, load, preload, refresh, disconnectPlatforms

I18n, View and Text are Clone + Send + Sync; I18n is an Arc inside, so clone it into threads and tasks. Cargo features: Features.

tauri-plugin-i18n-next

docs.rs/tauri-plugin-i18n-next

ItemWhatGuide
Buildernew(i18n), origins, system_locale, persist, global, watch, data_dir, buildTauri
ManagerExt::i18n, Handleapp.i18n(): derefs to I18n, plus bind, unbind, originsTauri
Relabel, BindIdwhat bind can relabel: menu items, submenus, windows, the tray tooltip (feature tray-icon), your own typesTauri
missingthe catalog's missing handler that feeds the dev reportTauri
protocol::handlethe i18n-next:// handler as a plain function
commands, modelsthe IPC commands and their payloadsCommands
EVENT_CHANGED, EVENT_MISSING, SCHEME"i18n-next://changed", "i18n-next://missing", "i18n-next"Tauri