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
| Item | What | Guide |
|---|---|---|
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 install | Loading, Locale files |
I18n | t (&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 |
View | an instance bound to a page and a locale: the same lookups as I18n | Translating |
Text | the lazy translated value: arg, args, count, or, page, locale, html, hide_if_empty, plural_rule, number, date, relative, resolve, write_to, fold, parts | Text, Rich text |
Args, Arg | borrowed parameters for t_with / tc_with, one argument value | Parameters |
t!, tc!, tn!, td!, tdr!, key!, Key | macros and const keys over the implicit instance (feature global) | Global access and scope |
install, global, t, set_locale, locale, page, tn, td, tdr, scope, negotiate | the global instance, a locale / page / instance per request or task, Accept-Language negotiation | Global access and scope |
Number, Timestamp, RelativeOptions, Count | values for formats and plurals | Formats, Plurals |
Change, Subscription | what subscribe reports, and the handle that ends it | Loading |
CheckReport, CheckItem, LinkError | the result of check() | Checks |
LocaleInfo | one entry of locales(): code, iso, dir, display_name | i18n.json |
Error | every error, #[non_exhaustive] | |
payload | feature payload: the front-end payload (encode, chunk, bundle, meta for the plugin; builder, apply for a Rust guest) | |
tauri_guest | feature tauri-guest, wasm32-unknown-unknown only: connect, set_page, set_locale, load, preload, refresh, disconnect | Platforms |
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
| Item | What | Guide |
|---|---|---|
Builder | new(i18n), origins, system_locale, persist, global, watch, data_dir, build | Tauri |
ManagerExt::i18n, Handle | app.i18n(): derefs to I18n, plus bind, unbind, origins | Tauri |
Relabel, BindId | what bind can relabel: menu items, submenus, windows, the tray tooltip (feature tray-icon), your own types | Tauri |
missing | the catalog's missing handler that feeds the dev report | Tauri |
protocol::handle | the i18n-next:// handler as a plain function | |
commands, models | the IPC commands and their payloads | Commands |
EVENT_CHANGED, EVENT_MISSING, SCHEME | "i18n-next://changed", "i18n-next://missing", "i18n-next" | Tauri |