1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! # I18n Macros
//!
//! Convenience macros for i18n translation lookup.
//!
//! ## `t!` — translate with key-or-key fallback
//!
//! ```ignore
//! let text = t!("common.button.submit"); // → "Submit" (or key itself if not found)
//! let missing = t!("nonexistent"); // → "nonexistent"
//! ```
//!
//! ## `tr!` — translate returning `Option<String>`
//!
//! ```ignore
//! let text = tr!("common.button.submit"); // → Some("Submit")
//! let missing = tr!("nonexistent"); // → None
//! ```
/// Translate a key using the current locale.
///
/// Returns `String` resolved from the i18n context. If the key is not found,
/// the key string itself is returned as a fallback.
///
/// # Key format
///
/// Dot-separated path: `t!("common.button.submit")`
///
/// # With interpolation
///
/// `t!("greeting", name = "World")` — after lookup, replaces `{name}` placeholders.
/// Translate a key, returning `Option<String>`.
///
/// Returns `None` if the key is not found in any locale (including fallback).
///
/// # Key format
///
/// Dot-separated path: `tr!("common.button.submit")`