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
//! **The language this server speaks** — one place that decides what `locale` means, and one place that applies it.
//!
//! Three layers can name a language, and they are read in this order:
//!
//! ```text
//! locale = "zh-CN" in .cppls.toml the project's own choice — most specific, so it wins
//! "locale": "zh-cn" in `initialize` the client's setting (VS Code's display language)
//! "en" the default, and the fallback for a key a translation does not carry
//! ```
//!
//! Applied through [`cpp_parser::set_locale`], which forwards to `rust-i18n`'s **process-wide** current locale —
//! so the parser's syntax errors, the analysis's diagnostics and this crate's own messages all change together. That
//! is the point of putting the call here rather than in each crate: a language is a property of the session, not of a
//! module.
/// **Use `locale` for every message from now on**, normalised to the tag the translation files are named with.
///
/// The tag is normalised because clients spell it three ways — `zh-cn` (the protocol's own example), `zh_CN`, and
/// `zh-CN` — while a file is one name. Region and language are taken as written, case-corrected: `zh_cn` → `zh-CN`.