| 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 = "ContactDetailsRaw", format = "", info = "Edit the RAW field") |
| 40 | KEY_ACTION_EDIT_FIELD, // |
| 41 | @Meta(what = "Action key", where = "ContactList", format = "", info = "Save the whole card") |
| 42 | KEY_ACTION_SAVE_CARD, // |
| 43 | @Meta(what = "", where = "ContactList/ContactDetailsRaw", format = "", info = "Delete the selected element") |
| 44 | KEY_ACTION_DELETE, // |
| 45 | @Meta(what = "Action key", where = "ContactList", format = "", info = "Filter the displayed contacts") |
| 46 | KEY_ACTION_SEARCH, // |
| 47 | @Meta(what = "", where = "", format = "we could use: ' ', ┃, │...", info = "Field separator") |
| 48 | DEAULT_FIELD_SEPARATOR, // MainContentList |
| 49 | @Meta(what = "Action key", where = "ContactDetails", format = "", info = "Invert the photo's colours") |
| 50 | KEY_ACTION_INVERT, // |
| 51 | @Meta(what = "Action key", where = "ContactDetails", format = "", info = "Show the photo in 'fullscreen'") |
| 52 | KEY_ACTION_FULLSCREEN, // |
| 53 | @Meta(what = "Action key", where = "ContactList, ContactDetails, ContactDetailsRaw", format = "", info = "Switch between the available display formats") |
| 54 | KEY_ACTION_SWITCH_FORMAT, // multi-usage |
| 55 | @Meta(what = "Action key", where = "Contact list, Edit Contact", format = "", info = "Add a new contact/field") |
| 56 | KEY_ACTION_ADD, // |
| 57 | @Meta(what = "User question: TEXT", where = "Contact list", format = "", info = "New contact") |
| 58 | ASK_USER_CONTACT_NAME, // |
| 59 | @Meta(what = "User question: [Y|N]", where = "Contact list", format = "%s = contact name", info = "Delete contact") |
| 60 | CONFIRM_USER_DELETE_CONTACT, // |
| 61 | @Meta(what = "Error", where = "Contact list", format = "%s = contact name", info = "cannot delete a contact") |
| 62 | ERR_CANNOT_DELETE_CONTACT, // |
| 63 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message header line") |
| 64 | CLI_HELP, // |
| 65 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line before explaining the different modes") |
| 66 | CLI_HELP_MODES, // |
| 67 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for help usage") |
| 68 | CLI_HELP_MODE_HELP, // |
| 69 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for contact manager usage") |
| 70 | CLI_HELP_MODE_CONTACT_MANAGER, // |
| 71 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for contact manager usage") |
| 72 | CLI_HELP_MODE_I18N, // |
| 73 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for jVCard server usage") |
| 74 | CLI_HELP_MODE_SERVER, // |
| 75 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for --load-photo usage") |
| 76 | CLI_HELP_MODE_LOAD_PHOTO, // |
| 77 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for --save-photo usage") |
| 78 | CLI_HELP_MODE_SAVE_PHOTO, // |
| 79 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for config save usage") |
| 80 | CLI_HELP_MODE_SAVE_CONFIG, // |
| 81 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line before the list of options") |
| 82 | CLI_HELP_OPTIONS, // |
| 83 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --") |
| 84 | CLI_HELP_DD, // |
| 85 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --") |
| 86 | CLI_HELP_LANG, // |
| 87 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --") |
| 88 | CLI_HELP_GUI, // |
| 89 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --") |
| 90 | CLI_HELP_TUI, // |
| 91 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --") |
| 92 | CLI_HELP_NOUTF, // |
| 93 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --") |
| 94 | CLI_HELP_CONFIG, // |
| 95 | @Meta(what = "CLI --help", where = "", format = "", info = "The Help message footer about files and jvcard:// links") |
| 96 | CLI_HELP_FOOTER, // |
| 97 | @Meta(what = "CLI ERROR", where = "", format = "%s = the error", info = "Syntax error: SOME TEXT") |
| 98 | CLI_SERR, // |
| 99 | @Meta(what = "CLI ERROR", where = "", format = "", info = "More than one mode given") |
| 100 | CLI_SERR_MODES, // |
| 101 | @Meta(what = "CLI ERROR", where = "", format = "", info = "--lang is required") |
| 102 | CLI_SERR_NOLANG, // |
| 103 | @Meta(what = "CLI ERROR", where = "", format = "", info = "The dir is required") |
| 104 | CLI_SERR_NODIR, // |
| 105 | @Meta(what = "CLI ERROR", where = "", format = "", info = "The port is required") |
| 106 | CLI_SERR_NOPORT, // |
| 107 | @Meta(what = "CLI ERROR", where = "", format = "", info = "The format is required") |
| 108 | CLI_SERR_NOFORMAT, // |
| 109 | @Meta(what = "CLI ERROR", where = "", format = "%s = bad port", info = "The port is not valid") |
| 110 | CLI_SERR_BADPORT, // |
| 111 | @Meta(what = "CLI ERROR", where = "", format = "%s = mode", info = "Card files are not supported in mode %s") |
| 112 | CLI_SERR_CANNOT_CARDS, // |
| 113 | @Meta(what = "CLI ERROR", where = "", format = "%s = the error", info = "Error: SOME TEXT") |
| 114 | CLI_ERR, // |
| 115 | @Meta(what = "CLI ERROR", where = "", format = "", info = "No files given") |
| 116 | CLI_ERR_NOFILES, // |
| 117 | @Meta(what = "CLI ERROR", where = "", format = "%s = dir", info = "Cannot create conf dir %s") |
| 118 | CLI_ERR_CANNOT_CREATE_CONFDIR, // |
| 119 | @Meta(what = "CLI ERROR", where = "", format = "", info = "Remoting not available") |
| 120 | CLI_ERR_NO_REMOTING, // |
| 121 | @Meta(what = "CLI ERROR", where = "", format = "", info = "TUI not available") |
| 122 | CLI_ERR_NO_TUI, // |
| 123 | @Meta(what = "CLI ERROR", where = "", format = "%s = dir", info = "Cannot create/update language in dir %s") |
| 124 | CLI_ERR_CANNOT_CREATE_LANG, // |
| 125 | @Meta(what = "CLI ERROR", where = "", format = "%s = card", info = "Cannot open card %s") |
| 126 | CLI_ERR_CANNOT_OPEN, // |
| 127 | @Meta(what = "CLI ERROR", where = "", format = "%s = contact FN", info = "Cannot save photo of contact %s") |
| 128 | CLI_ERR_CANNOT_SAVE_PHOTO, // |
| 129 | @Meta(what = "CLI ERROR", where = "", format = "", info = "Cannot start the program with the given cards") |
| 130 | CLI_ERR_CANNOT_START, // |
| 131 | |
| 132 | ; |
| 133 | |
| 134 | /** |
| 135 | * Write the header found in the configuration <tt>.properties</tt> file of |
| 136 | * this {@link Bundle}. |
| 137 | * |
| 138 | * @param writer |
| 139 | * the {@link Writer} to write the header in |
| 140 | * @param name |
| 141 | * the file name |
| 142 | * |
| 143 | * @throws IOException |
| 144 | * in case of IO error |
| 145 | */ |
| 146 | static public void writeHeader(Writer writer, String name) |
| 147 | throws IOException { |
| 148 | writer.write("# " + name + " translation file (UTF-8)\n"); |
| 149 | writer.write("# \n"); |
| 150 | writer.write("# Note that any key can be doubled with a _NOUTF suffix\n"); |
| 151 | writer.write("# to use when the flag --noutf is passed\n"); |
| 152 | writer.write("# \n"); |
| 153 | writer.write("# Also, the comments always refer to the key below them.\n"); |
| 154 | writer.write("# \n"); |
| 155 | } |
| 156 | }; |