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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! Internationalization related types.
//!
//! # Load resources from file system
//!
//! ```no_run
//! use poem::i18n::I18NResources;
//!
//! let resources = I18NResources::builder()
//! .add_path("/resources")
//! .build()
//! .unwrap();
//! ```
//!
//! # Load resources from string
//!
//! ```
//! use poem::i18n::I18NResources;
//!
//! let en_us = r#"
//! hello-world = Hello world!
//! welcome = Welcome { $name }!
//! "#;
//!
//! let zh_cn = r#"
//! hello-world = 你好!
//! welcome = 欢迎 { $name }!
//! "#;
//!
//! let resources = I18NResources::builder()
//! .add_ftl("en-US", en_us)
//! .add_ftl("zh-CN", zh_cn)
//! .build()
//! .unwrap();
//! ```
//!
//! # Negotiation
//!
//! ```no_run
//! use poem::i18n::I18NResources;
//! use unic_langid::{langid, langids};
//!
//! let resources = I18NResources::builder()
//! .add_path("/resources")
//! .build()
//! .unwrap();
//!
//! let bundle = resources.negotiate_languages(&langids!("zh-CN", "en-US", "fr"));
//!
//! // get text
//! let hello_world = bundle.text("hello-world").unwrap();
//!
//! // get text with arguments
//! let welcome = bundle
//! .text_with_args("welcome", (("name", "sunli"),))
//! .unwrap();
//! ```
//!
//! # Use extractor
//!
//! See also: [`crate::i18n::Locale`]
pub use NegotiationStrategy;
pub use unic_langid;
pub use ;