One translation catalog for Rust, Tauri and the browser
The nuxt-i18n-micro locale format in Rust: root and page chunks, plurals and Intl-compatible formats, with a Tauri plugin that feeds @i18n-micro on the frontend.
Rust and the frontend, same files
Install once in Rust and call t! anywhere. The Tauri plugin hands the same catalog to @i18n-micro/vue, one page at a time.
use i18n_next::{I18n, t};
let i18n = I18n::builder().dir("locales").locale("ru").fallback("en").build()?;
tauri::Builder::default()
.plugin(tauri_plugin_i18n_next::Builder::new(i18n).build()) // installs the global instance
.setup(|_app| {
println!("{}", t!("cart.summary", name = "Ann", count = 3)); // t! works anywhere now
Ok(())
})
import { createTauriI18n } from 'tauri-plugin-i18n-next-api/vue'
app.use(await createTauriI18n({ router })) // page chunks load before each navigation
// <i18n-t keypath="cart.total" :number="sum" />