1#![doc = include_str!("../Locales.md")]
2use std::{borrow::Cow, collections::HashMap};
3
4#[cfg(any(feature = "serde", test))]
5use serde::{Deserialize, Serialize};
6
7#[cfg(any(feature = "serde", test))]
8pub fn get_en() -> Locale<'static> {
9 serde_json::de::from_str(include_str!("en.json")).unwrap()
10}
11#[cfg(any(feature = "serde", test))]
12pub fn get_en_fuck() -> Locale<'static> {
13 serde_json::de::from_str(include_str!("en_fuck.json")).unwrap()
14}
15#[cfg(any(feature = "serde", test))]
16pub fn get_de() -> Locale<'static> {
17 serde_json::de::from_str(include_str!("de.json")).unwrap()
18}
19#[cfg(any(feature = "serde", test))]
20pub fn get_ru() -> Locale<'static> {
21 serde_json::de::from_str(include_str!("ru.json")).unwrap()
22}
23#[cfg(any(feature = "serde", test))]
24pub fn get_it() -> Locale<'static> {
25 serde_json::de::from_str(include_str!("it.json")).unwrap()
26}
27#[cfg(any(feature = "serde", test))]
28pub fn get_fr() -> Locale<'static> {
29 serde_json::de::from_str(include_str!("fr.json")).unwrap()
30}
31#[cfg(any(feature = "serde", test))]
32pub fn get_nl() -> Locale<'static> {
33 serde_json::de::from_str(include_str!("nl.json")).unwrap()
34}
35#[cfg(any(feature = "serde", test))]
36pub fn get_all() -> impl Iterator<Item = (&'static str, Locale<'static>)> {
37 [
38 ("en", get_en()),
39 ("en_fuck", get_en_fuck()),
40 ("de", get_de()),
41 ("ru", get_ru()),
42 ("it", get_it()),
43 ("fr", get_fr()),
44 ("nl", get_nl()),
45 ]
46 .into_iter()
47}
48
49#[derive(Debug, Clone)]
50#[cfg_attr(any(feature = "serde", test), derive(Serialize, Deserialize))]
51pub struct Locale<'a> {
52 pub bot_disclaimer: Cow<'a, str>,
53 pub notes: Notes<'a>,
54 pub format: Format<'a>,
55}
56#[derive(Debug, Clone)]
57#[cfg_attr(any(feature = "serde", test), derive(Serialize, Deserialize))]
58pub struct Notes<'a> {
59 pub tower: Cow<'a, str>,
60 pub tower_mult: Cow<'a, str>,
61 pub digits: Cow<'a, str>,
62 pub digits_mult: Cow<'a, str>,
63 pub approx: Cow<'a, str>,
64 pub approx_mult: Cow<'a, str>,
65 pub round: Cow<'a, str>,
66 pub round_mult: Cow<'a, str>,
67 pub too_big: Cow<'a, str>,
68 pub too_big_mult: Cow<'a, str>,
69 pub remove: Cow<'a, str>,
70 pub tetration: Cow<'a, str>,
71 pub no_post: Cow<'a, str>,
72 pub mention: Cow<'a, str>,
73 pub limit_hit: Option<Cow<'a, str>>,
74 pub write_out_unsupported: Option<Cow<'a, str>>,
75}
76
77#[derive(Debug, Clone)]
78#[cfg_attr(any(feature = "serde", test), derive(Serialize, Deserialize))]
79pub struct Format<'a> {
80 pub capitalize_calc: bool,
81 pub termial: Cow<'a, str>,
82 pub factorial: Cow<'a, str>,
83 pub uple: Cow<'a, str>,
84 pub sub: Cow<'a, str>,
85 pub negative: Cow<'a, str>,
86 pub num_overrides: HashMap<i32, Cow<'a, str>>,
87 pub force_num: bool,
88 pub nest: Cow<'a, str>,
89 pub rough_number: Cow<'a, str>,
90 pub exact: Cow<'a, str>,
91 pub rough: Cow<'a, str>,
92 pub approx: Cow<'a, str>,
93 pub digits: Cow<'a, str>,
94 pub order: Cow<'a, str>,
95 pub all_that: Cow<'a, str>,
96 pub number_format: NumFormat,
97}
98
99#[derive(Debug, Clone)]
100#[cfg_attr(any(feature = "serde", test), derive(Serialize, Deserialize))]
101pub struct NumFormat {
102 pub decimal: char,
103}