Skip to main content

fb2_clean/
i18n.rs

1macro_rules! impl_msg_as_str {
2    ($fn:ident, $( $enum_var:ident => $text:expr ),* $(,)?) => {
3        impl $crate::Msg {
4            #[inline(always)]
5            pub(in crate::i18n) fn $fn(self) -> &'static str {
6                match self {
7                    $( Self::$enum_var => $text ),*
8                }
9            }
10        }
11    };
12}
13
14mod pubs;
15
16mod eng;
17mod rus;
18
19/// A language of message.
20#[derive(Copy, Clone, Debug, Default, PartialEq)]
21#[non_exhaustive]
22pub enum Lang {
23    #[default]
24    Eng,
25    Rus,
26}
27
28/// A message with localized methods.
29#[derive(Copy, Clone, Debug)]
30#[non_exhaustive]
31pub enum Msg {
32    Cleaning,
33    CleaningBooks,
34    FileIsAlreadyExists,
35    NotFoundAValidLangCode,
36    NotFoundAnyBookInDirectory,
37    NotFoundAnyFb2InArchive,
38    Overwriting,
39    OverwritingBooks,
40    RemovingInputFile,
41    RemovingTempDirectory,
42    RemovingTempFile,
43    Skipping,
44    SuccessCleanedAndSavedTo,
45    SuccessOverwritedFrom,
46    Error,
47    Warning,
48    Debug,
49    Trace,
50    GuiStart,
51    GuiLanguage,
52    GuiSelectInputDirectory,
53    GuiSelectInputFile,
54    GuiInputSet,
55    GuiErrorSetInput,
56    GuiSelectOutputDirectory,
57    GuiSaveDirectory,
58    GuiOutputSet,
59    GuiErrorSetOutput,
60    GuiRemoveTags,
61    GuiTagsSet,
62    GuiMultithreading,
63    GuiRecursiveSearch,
64    GuiOverwrite,
65    GuiStopOnError,
66    GuiLog,
67    HelpInput,
68    HelpOutput,
69    HelpRecursive,
70    HelpTags,
71    HelpZip,
72    HelpUnzip,
73    HelpOverwrite,
74    HelpExitOnError,
75    HelpJobs,
76    HelpLang,
77    HelpVersion,
78    HelpHelp,
79}