(README update)
[fanfix.git] / src / be / nikiroo / fanfix / bundles / StringId.java
1 package be.nikiroo.fanfix.bundles;
2
3 import java.io.IOException;
4 import java.io.Writer;
5
6 import be.nikiroo.utils.resources.Bundle;
7 import be.nikiroo.utils.resources.Meta;
8
9 /**
10 * The {@link Enum} representing textual information to be translated to the
11 * user as a key.
12 *
13 * Note that each key that should be translated <b>must</b> be annotated with a
14 * {@link Meta} annotation.
15 *
16 * @author niki
17 */
18 public enum StringId {
19 /**
20 * A special key used for technical reasons only, without annotations so it
21 * is not visible in <tt>.properties</tt> files.
22 * <p>
23 * Use it when you need NO translation.
24 */
25 NULL, //
26 /**
27 * A special key used for technical reasons only, without annotations so it
28 * is not visible in <tt>.properties</tt> files.
29 * <p>
30 * Use it when you need a real translation but still don't have a key.
31 */
32 DUMMY, //
33 @Meta(what = "help message", where = "cli", format = "%s = supported input, %s = supported output", info = "help message for the syntax")
34 HELP_SYNTAX, //
35 @Meta(what = "error message", where = "cli", format = "", info = "syntax error message")
36 ERR_SYNTAX, //
37 @Meta(what = "error message", where = "cli", format = "%s = support name, %s = support desc", info = "an input or output support type description")
38 ERR_SYNTAX_TYPE, //
39 @Meta(what = "error message", where = "cli", format = "%s = input string", info = "Error when retrieving data")
40 ERR_LOADING, //
41 @Meta(what = "error message", where = "cli", format = "%s = save target", info = "Error when saving to given target")
42 ERR_SAVING, //
43 @Meta(what = "error message", where = "cli", format = "%s = bad output format", info = "Error when unknown output format")
44 ERR_BAD_OUTPUT_TYPE, //
45 @Meta(what = "error message", where = "cli", format = "%s = input string", info = "Error when converting input to URL/File")
46 ERR_BAD_URL, //
47 @Meta(what = "error message", where = "cli", format = "%s = input url", info = "URL/File not supported")
48 ERR_NOT_SUPPORTED, //
49 @Meta(what = "error message", where = "BasicSupport", format = "%s = cover URL", info = "Failed to download cover : %s")
50 ERR_BS_NO_COVER, //
51 @Meta(what = "char", where = "LaTeX/BasicSupport", format = "single char", info = "Canonical OPEN SINGLE QUOTE char (for instance: `)")
52 OPEN_SINGLE_QUOTE, //
53 @Meta(what = "char", where = "LaTeX/BasicSupport", format = "single char", info = "Canonical CLOSE SINGLE QUOTE char (for instance: ‘)")
54 CLOSE_SINGLE_QUOTE, //
55 @Meta(what = "char", where = "LaTeX/BasicSupport", format = "single char", info = "Canonical OPEN DOUBLE QUOTE char (for instance: “)")
56 OPEN_DOUBLE_QUOTE, //
57 @Meta(what = "char", where = "LaTeX/BasicSupport", format = "single char", info = "Canonical CLOSE DOUBLE QUOTE char (for instance: ”)")
58 CLOSE_DOUBLE_QUOTE, //
59 @Meta(what = "chapter name", where = "BasicSupport", format = "", info = "Name of the description fake chapter")
60 DESCRIPTION, //
61 @Meta(what = "chapter name", where = "", format = "%d = number, %s = name", info = "Name of a chapter with a name")
62 CHAPTER_NAMED, //
63 @Meta(what = "chapter name", where = "", format = "%d = number, %s = name", info = "Name of a chapter without name")
64 CHAPTER_UNNAMED, //
65 @Meta(what = "input format description", where = "SupportType", format = "%s = type", info = "Default description when the type is not known by i18n")
66 INPUT_DESC, //
67 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
68 INPUT_DESC_EPUB, //
69 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
70 INPUT_DESC_TEXT, //
71 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
72 INPUT_DESC_INFO_TEXT, //
73 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
74 INPUT_DESC_FANFICTION, //
75 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
76 INPUT_DESC_FIMFICTION, //
77 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
78 INPUT_DESC_MANGAFOX, //
79 @Meta(what = "input format description", where = "SupportType", format = "", info = "Description of this input type")
80 INPUT_DESC_E621, //
81 @Meta(what = "output format description", where = "OutputType", format = "%s = type", info = "Default description when the type is not known by i18n")
82 OUTPUT_DESC, //
83 @Meta(what = "output format description", where = "OutputType", format = "", info = "Description of this output type")
84 OUTPUT_DESC_EPUB, //
85 @Meta(what = "output format description", where = "OutputType", format = "", info = "Description of this output type")
86 OUTPUT_DESC_TEXT, //
87 @Meta(what = "output format description", where = "OutputType", format = "", info = "Description of this output type")
88 OUTPUT_DESC_INFO_TEXT, //
89 @Meta(what = "output format description", where = "OutputType", format = "", info = "Description of this output type")
90 OUTPUT_DESC_CBZ, //
91 @Meta(what = "output format description", where = "OutputType", format = "", info = "Description of this output type")
92 OUTPUT_DESC_HTML, //
93 @Meta(what = "output format description", where = "OutputType", format = "", info = "Description of this output type")
94 OUTPUT_DESC_LATEX, //
95 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
96 OUTPUT_DESC_SYSOUT, //
97 @Meta(what = "short output format description", where = "OutputType", format = "%s = type", info = "Default description when the type is not known by i18n")
98 OUTPUT_DESC_SHORT, //
99 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
100 OUTPUT_DESC_SHORT_EPUB, //
101 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
102 OUTPUT_DESC_SHORT_TEXT, //
103 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
104 OUTPUT_DESC_SHORT_INFO_TEXT, //
105 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
106 OUTPUT_DESC_SHORT_CBZ, //
107 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
108 OUTPUT_DESC_SHORT_LATEX, //
109 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
110 OUTPUT_DESC_SHORT_SYSOUT, //
111 @Meta(what = "short output format description", where = "OutputType", format = "", info = "Description of this output type")
112 OUTPUT_DESC_SHORT_HTML, //
113 @Meta(what = "error message", where = "LaTeX", format = "%s = the unknown 2-code language", info = "Error message for unknown 2-letter LaTeX language code")
114 LATEX_LANG_UNKNOWN, //
115 @Meta(what = "'by' prefix before author name", where = "", format = "", info = "used to output the author, make sure it is covered by Config.BYS for input detection")
116 BY, //
117
118 ;
119
120 /**
121 * Write the header found in the configuration <tt>.properties</tt> file of
122 * this {@link Bundle}.
123 *
124 * @param writer
125 * the {@link Writer} to write the header in
126 * @param name
127 * the file name
128 *
129 * @throws IOException
130 * in case of IO error
131 */
132 static public void writeHeader(Writer writer, String name)
133 throws IOException {
134 writer.write("# " + name + " translation file (UTF-8)\n");
135 writer.write("# \n");
136 writer.write("# Note that any key can be doubled with a _NOUTF suffix\n");
137 writer.write("# to use when the NOUTF env variable is set to 1\n");
138 writer.write("# \n");
139 writer.write("# Also, the comments always refer to the key below them.\n");
140 writer.write("# \n");
141 }
142 };