forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits

link.rs68 lines, 2.2 KiBHistoryRawDownload
1//! Strings for the bar that shows while the server restarts. The shell puts them on `<body>` so
2//! `nav.js` can show them without its own copy.
3
4use super::Lang;
5
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7pub enum K {
8 Restarting,
9 BackSubmit,
10 /// The tick after a settings form saved.
11 Saved,
12 /// The tick after another form succeeded.
13 Done,
14 /// The note under a comment draft put back into its field.
15 DraftRestored,
16 /// The button that drops a restored draft.
17 DraftDiscard,
18 /// The placeholder of the search field over a long select dropdown.
19 SelectFilter,
20 /// The line a select search shows when no option matches.
21 SelectNone,
22}
23
24/// The phrase for `key`.
25pub fn t(lang: Lang, key: K) -> &'static str {
26 use K::*;
27 match (key, lang) {
28 (Restarting, Lang::En) => "Server restarting\u{2026} your page is kept",
29 (Restarting, Lang::Tr) => "Sunucu yeniden başlıyor\u{2026} sayfanız korunuyor",
30 (BackSubmit, Lang::En) => "Server is back, submit again",
31 (BackSubmit, Lang::Tr) => "Sunucu geri geldi, tekrar gönderin",
32 (Saved, Lang::En) => "Saved",
33 (Saved, Lang::Tr) => "Kaydedildi",
34 (Done, Lang::En) => "Done",
35 (Done, Lang::Tr) => "Tamam",
36 (DraftRestored, Lang::En) => "Draft restored",
37 (DraftRestored, Lang::Tr) => "Taslak geri yüklendi",
38 (DraftDiscard, Lang::En) => "Discard",
39 (DraftDiscard, Lang::Tr) => "Vazgeç",
40 (SelectFilter, Lang::En) => "Search\u{2026}",
41 (SelectFilter, Lang::Tr) => "Ara\u{2026}",
42 (SelectNone, Lang::En) => "No matches",
43 (SelectNone, Lang::Tr) => "Eşleşme yok",
44 }
45}
46
47#[cfg(test)]
48mod tests {
49 use super::*;
50
51 #[test]
52 fn every_string_has_no_em_dash() {
53 for lang in [Lang::En, Lang::Tr] {
54 for key in [
55 K::Restarting,
56 K::BackSubmit,
57 K::Saved,
58 K::Done,
59 K::DraftRestored,
60 K::DraftDiscard,
61 K::SelectFilter,
62 K::SelectNone,
63 ] {
64 assert!(!t(lang, key).contains('\u{2014}'));
65 }
66 }
67 }
68}