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