Skip to main content

hs_predict/session/
messages.rs

1//! Localised prompt strings for session questions.
2//!
3//! All user-visible text lives here so that adding a new language only
4//! requires a new `match` arm, not a search across multiple files.
5
6use crate::types::Language;
7
8// ─── Question prompts ────────────────────────────────────────────────────────
9
10/// Returns `(prompt, example)` for the main identifier question.
11pub(crate) fn q_identifier(lang: Language) -> (String, String) {
12    match lang {
13        Language::En => (
14            "Enter a chemical identifier (CAS number, IUPAC name, SMILES, or InChIKey)".into(),
15            "e.g. 1310-73-2  or  sodium hydroxide  or  [Na+].[OH-]".into(),
16        ),
17        Language::Ja => (
18            "化合物を特定する情報を入力してください(CAS番号 / IUPAC名 / SMILES / InChIKey のいずれか)".into(),
19            "例: 1310-73-2 または sodium hydroxide または [Na+].[OH-]".into(),
20        ),
21    }
22}
23
24/// Returns the "is this a mixture?" yes/no prompt.
25pub(crate) fn q_is_mixture(lang: Language) -> String {
26    match lang {
27        Language::En => "Is this product a mixture of two or more compounds?".into(),
28        Language::Ja => "この製品は 2 種類以上の化合物の混合物ですか?".into(),
29    }
30}
31
32/// Returns `(prompt, unit)` for the component count question.
33pub(crate) fn q_component_count(lang: Language) -> (String, String) {
34    match lang {
35        Language::En => ("How many components does it contain?".into(), "components".into()),
36        Language::Ja => ("何種類の成分が含まれていますか?".into(), "種類".into()),
37    }
38}
39
40/// Returns `(prompt, example)` for the n-th component identifier question (1-based).
41pub(crate) fn q_component_identifier(lang: Language, n: usize) -> (String, String) {
42    match lang {
43        Language::En => (
44            format!("Enter the CAS number or IUPAC name of component {n}"),
45            "e.g. 7664-93-9  or  sulphuric acid".into(),
46        ),
47        Language::Ja => (
48            format!("成分 {n} の CAS番号 または IUPAC名 を入力してください"),
49            "例: 7664-93-9 または sulphuric acid".into(),
50        ),
51    }
52}
53
54/// Returns `(prompt, unit)` for the component weight-fraction question.
55pub(crate) fn q_component_fraction(lang: Language, name: &str) -> (String, String) {
56    match lang {
57        Language::En => (
58            format!("Enter the weight fraction of \"{name}\" (enter 0 if unknown)"),
59            "w/w%".into(),
60        ),
61        Language::Ja => (
62            format!("「{name}」の重量割合 (w/w%) を入力してください(わからない場合は 0)"),
63            "w/w%".into(),
64        ),
65    }
66}
67
68/// Returns `(prompt, options[])` for the physical-form choice question.
69pub(crate) fn q_physical_form(lang: Language) -> (String, Vec<String>) {
70    match lang {
71        Language::En => (
72            "Select the physical form of this product".into(),
73            vec![
74                "Solid (lumps, pellets, flakes, etc.)".into(),
75                "Powder".into(),
76                "Granules".into(),
77                "Pure liquid (not a solution)".into(),
78                "Solution (aqueous or in organic solvent)".into(),
79                "Gas / vapour".into(),
80                "Foil (metal foil, etc.)".into(),
81                "Ingot (cast metal)".into(),
82                "Unknown".into(),
83            ],
84        ),
85        Language::Ja => (
86            "この製品の物理的形状を選んでください".into(),
87            vec![
88                "固体(塊・ペレット・フレーク等)".into(),
89                "粉末".into(),
90                "粒状(造粒品)".into(),
91                "純液体(溶液でない)".into(),
92                "溶液(水溶液または有機溶媒溶液)".into(),
93                "気体・蒸気".into(),
94                "箔(金属箔等)".into(),
95                "インゴット(鋳造品)".into(),
96                "わからない".into(),
97            ],
98        ),
99    }
100}
101
102/// Returns `(prompt, unit)` for the solution concentration question.
103pub(crate) fn q_solution_concentration(lang: Language) -> (String, String) {
104    match lang {
105        Language::En => (
106            "Enter the solute concentration (enter 0 if unknown)".into(),
107            "w/w%".into(),
108        ),
109        Language::Ja => (
110            "溶質の濃度を入力してください(わからない場合は 0 と入力)".into(),
111            "w/w%".into(),
112        ),
113    }
114}
115
116/// Returns `(prompt, options[])` for the intended-use choice question.
117pub(crate) fn q_intended_use(lang: Language) -> (String, Vec<String>) {
118    match lang {
119        Language::En => (
120            "Select the primary intended use of this product".into(),
121            vec![
122                "Industrial (raw material, catalyst, solvent, etc.)".into(),
123                "Pharmaceutical / medical".into(),
124                "Agrochemical / fertiliser".into(),
125                "Food / food additive".into(),
126                "Cosmetic".into(),
127                "Other / unknown".into(),
128            ],
129        ),
130        Language::Ja => (
131            "この製品の主な用途を選んでください".into(),
132            vec![
133                "工業用(原料・触媒・溶剤等)".into(),
134                "医薬品・医療用".into(),
135                "農薬・肥料".into(),
136                "食品・食品添加物".into(),
137                "化粧品".into(),
138                "その他 / わからない".into(),
139            ],
140        ),
141    }
142}
143
144/// Returns `(prompt, options[])` for the organic/inorganic choice question.
145pub(crate) fn q_organic_inorganic(lang: Language) -> (String, Vec<String>) {
146    match lang {
147        Language::En => (
148            "Is this compound organic or inorganic?".into(),
149            vec![
150                "Organic (carbon-backbone compound)".into(),
151                "Inorganic".into(),
152                "Unknown".into(),
153            ],
154        ),
155        Language::Ja => (
156            "この化合物は有機化合物ですか?".into(),
157            vec![
158                "有機化合物(炭素骨格を持つ)".into(),
159                "無機化合物".into(),
160                "わからない".into(),
161            ],
162        ),
163    }
164}
165
166/// Returns `(prompt, options[])` for the functional-groups multi-choice question.
167pub(crate) fn q_functional_groups(lang: Language) -> (String, Vec<String>) {
168    match lang {
169        Language::En => (
170            "Select the main functional groups / structural features (multiple selection allowed)".into(),
171            vec![
172                "Carboxylic acid (-COOH)".into(),
173                "Alcohol (-OH, aliphatic)".into(),
174                "Phenol (-OH, aromatic)".into(),
175                "Aldehyde (-CHO)".into(),
176                "Ketone (C=O)".into(),
177                "Amine (-NH2 / -NH-)".into(),
178                "Amide (-CONH-)".into(),
179                "Nitrile (-CN)".into(),
180                "Halide (-Cl / -Br / -F / -I)".into(),
181                "Ester (-COO-)".into(),
182                "Aromatic ring".into(),
183                "Other / unknown".into(),
184            ],
185        ),
186        Language::Ja => (
187            "主な官能基・化学構造を選んでください(複数選択可)".into(),
188            vec![
189                "カルボン酸 (-COOH)".into(),
190                "アルコール (-OH、脂肪族)".into(),
191                "フェノール (-OH、芳香族)".into(),
192                "アルデヒド (-CHO)".into(),
193                "ケトン (C=O)".into(),
194                "アミン (-NH2 / -NH-)".into(),
195                "アミド (-CONH-)".into(),
196                "ニトリル (-CN)".into(),
197                "ハロゲン化物 (-Cl / -Br / -F / -I)".into(),
198                "エステル (-COO-)".into(),
199                "芳香族環".into(),
200                "その他 / わからない".into(),
201            ],
202        ),
203    }
204}
205
206/// Returns `(prompt, example)` for the second component identifier question
207/// (the "next component" branch in the mixture flow).
208pub(crate) fn q_next_component_identifier(lang: Language, n: usize) -> (String, String) {
209    match lang {
210        Language::En => (
211            format!("Enter the CAS number or IUPAC name of component {n}"),
212            "e.g. 7732-18-5  or  water".into(),
213        ),
214        Language::Ja => (
215            format!("成分 {n} の CAS番号 または IUPAC名 を入力してください"),
216            "例: 7732-18-5 または water".into(),
217        ),
218    }
219}