Commit | Line | Data |
---|---|---|
e119a1c1 NR |
1 | package be.nikiroo.jvcard.resources.enums; |
2 | ||
3 | import java.io.IOException; | |
4 | import java.io.Writer; | |
5 | ||
6 | import be.nikiroo.jvcard.resources.Bundles.Bundle; | |
7 | import be.nikiroo.jvcard.resources.Meta; | |
8 | ||
9 | /** | |
10 | * The enum representing textual information to be translated to the user as a | |
11 | * key. | |
12 | * | |
13 | * Note that each key that should be translated MUST be annotated with a | |
14 | * {@link Meta} annotation. | |
15 | * | |
16 | * @author niki | |
17 | * | |
18 | */ | |
19 | public enum StringId { | |
20 | DUMMY, // <-- TODO : remove | |
21 | NULL, // Special usage, no annotations so it is not visible in | |
22 | // .properties files | |
23 | @Meta(what = "a key to press", where = "action keys", format = "MUST BE 3 chars long", info = "Tab key") | |
24 | KEY_TAB, // keys | |
25 | @Meta(what = "a key to press", where = "action keys", format = "MUST BE 3 chars long", info = "Enter key") | |
26 | KEY_ENTER, // | |
27 | @Meta(what = "Action key", where = "All screens except the first (KEY_ACTION_QUIT)", format = "", info = "Go back to previous screen") | |
28 | KEY_ACTION_BACK, // | |
29 | @Meta(what = "Action key", where = "MainWindow", format = "", info = "Get help text") | |
30 | KEY_ACTION_HELP, // | |
31 | @Meta(what = "Action key", where = "FileList", format = "", info = "View the selected card") | |
32 | KEY_ACTION_VIEW_CARD, // | |
33 | @Meta(what = "Action key", where = "ContactList", format = "", info = "View the selected contact") | |
34 | KEY_ACTION_VIEW_CONTACT, // | |
35 | @Meta(what = "Action key", where = "ContactDetails", format = "", info = "Edit the contact") | |
36 | KEY_ACTION_EDIT_CONTACT, // | |
37 | @Meta(what = "Action key", where = "ContactDetails", format = "", info = "Edit the contact in RAW mode") | |
38 | KEY_ACTION_EDIT_CONTACT_RAW, // | |
39 | @Meta(what = "Action key", where = "ContactList", format = "", info = "Save the whole card") | |
40 | KEY_ACTION_SAVE_CARD, // | |
41 | @Meta(what = "", where = "ContactList", format = "", info = "Delete the selected contact") | |
42 | KEY_ACTION_DELETE_CONTACT, // | |
43 | @Meta(what = "Action key", where = "ContactList", format = "", info = "Filter the displayed contacts") | |
44 | KEY_ACTION_SEARCH, // | |
45 | @Meta(what = "", where = "", format = "we could use: ' ', ┃, │...", info = "Field separator") | |
46 | DEAULT_FIELD_SEPARATOR, // MainContentList | |
47 | @Meta(what = "Action key", where = "ContactDetails", format = "", info = "Invert the photo's colours") | |
48 | KEY_ACTION_INVERT, // | |
49 | @Meta(what = "Action key", where = "ContactDetails", format = "", info = "Show the photo in 'fullscreen'") | |
50 | KEY_ACTION_FULLSCREEN, // | |
51 | @Meta(what = "Action key", where = "ContactList, ContactDetails, ContactDetailsRaw", format = "", info = "Switch between the available display formats") | |
52 | KEY_ACTION_SWITCH_FORMAT, // multi-usage | |
53 | @Meta(what = "Action key", where = "Contact list, Edit Contact", format = "", info = "Add a new contact/field") | |
54 | KEY_ACTION_ADD, // | |
55 | @Meta(what = "User question: TEXT", where = "Contact list", format = "", info = "New contact") | |
56 | ASK_USER_CONTACT_NAME, // | |
57 | @Meta(what = "User question: [Y|N]", where = "Contact list", format = "%s = contact name", info = "Delete contact") | |
58 | CONFIRM_USER_DELETE_CONTACT, // | |
59 | @Meta(what = "Error", where = "Contact list", format = "%s = contact name", info = "cannot delete a contact") | |
60 | ERR_CANNOT_DELETE_CONTACT, // | |
61 | ||
62 | ; | |
63 | ||
64 | /** | |
65 | * Write the header found in the configuration <tt>.properties</tt> file of | |
66 | * this {@link Bundle}. | |
67 | * | |
68 | * @param writer | |
69 | * the {@link Writer} to write the header in | |
70 | * @param name | |
71 | * the file name | |
72 | * | |
73 | * @throws IOException | |
74 | * in case of IO error | |
75 | */ | |
76 | static public void writeHeader(Writer writer, String name) | |
77 | throws IOException { | |
78 | writer.write("# " + name + " translation file (UTF-8)\n"); | |
79 | writer.write("# \n"); | |
80 | writer.write("# Note that any key can be doubled with a _NOUTF suffix\n"); | |
81 | writer.write("# to use when the flag --noutf is passed\n"); | |
82 | writer.write("# \n"); | |
83 | writer.write("# Also, the comments always refer to the key below them.\n"); | |
84 | writer.write("# \n"); | |
85 | writer.write("\n"); | |
86 | } | |
87 | }; |