| 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 | import be.nikiroo.utils.resources.Meta.Format; |
| 9 | |
| 10 | /** |
| 11 | * The {@link Enum} representing textual information to be translated to the |
| 12 | * user as a key. |
| 13 | * |
| 14 | * Note that each key that should be translated <b>must</b> be annotated with a |
| 15 | * {@link Meta} annotation. |
| 16 | * |
| 17 | * @author niki |
| 18 | */ |
| 19 | @SuppressWarnings("javadoc") |
| 20 | public enum StringIdGui { |
| 21 | /** |
| 22 | * A special key used for technical reasons only, without annotations so it |
| 23 | * is not visible in <tt>.properties</tt> files. |
| 24 | * <p> |
| 25 | * Use it when you need NO translation. |
| 26 | */ |
| 27 | NULL, // |
| 28 | /** |
| 29 | * A special key used for technical reasons only, without annotations so it |
| 30 | * is not visible in <tt>.properties</tt> files. |
| 31 | * <p> |
| 32 | * Use it when you need a real translation but still don't have a key. |
| 33 | */ |
| 34 | DUMMY, // |
| 35 | @Meta(def = "Fanfix %s", format = Format.STRING, description = "the title of the main window of Fanfix, the library", info = "%s = current Fanfix version") |
| 36 | // The titles/subtitles: |
| 37 | TITLE_LIBRARY, // |
| 38 | @Meta(def = "Fanfix %s", format = Format.STRING, description = "the title of the main window of Fanfix, the library, when the library has a name (i.e., is not local)", info = "%s = current Fanfix version, %s = library name") |
| 39 | TITLE_LIBRARY_WITH_NAME, // |
| 40 | @Meta(def = "Fanfix Configuration", format = Format.STRING, description = "the title of the configuration window of Fanfix, also the name of the menu button") |
| 41 | TITLE_CONFIG, // |
| 42 | @Meta(def = "This is where you configure the options of the program.", format = Format.STRING, description = "the subtitle of the configuration window of Fanfix") |
| 43 | SUBTITLE_CONFIG, // |
| 44 | @Meta(def = "UI Configuration", format = Format.STRING, description = "the title of the UI configuration window of Fanfix, also the name of the menu button") |
| 45 | TITLE_CONFIG_UI, // |
| 46 | @Meta(def = "This is where you configure the graphical appearence of the program.", format = Format.STRING, description = "the subtitle of the UI configuration window of Fanfix") |
| 47 | SUBTITLE_CONFIG_UI, // |
| 48 | @Meta(def = "Save", format = Format.STRING, description = "the title of the 'save to/export to' window of Fanfix") |
| 49 | TITLE_SAVE, // |
| 50 | @Meta(def = "Moving story", format = Format.STRING, description = "the title of the 'move to' window of Fanfix") |
| 51 | TITLE_MOVE_TO, // |
| 52 | @Meta(def = "Move to:", format = Format.STRING, description = "the subtitle of the 'move to' window of Fanfix") |
| 53 | SUBTITLE_MOVE_TO, // |
| 54 | @Meta(def = "Delete story", format = Format.STRING, description = "the title of the 'delete' window of Fanfix") |
| 55 | TITLE_DELETE, // |
| 56 | @Meta(def = "Delete %s: %s", format = Format.STRING, description = "the subtitle of the 'delete' window of Fanfix", info = "%s = LUID of the story, %s = title of the story") |
| 57 | SUBTITLE_DELETE, // |
| 58 | @Meta(def = "Library error", format = Format.STRING, description = "the title of the 'library error' dialogue") |
| 59 | TITLE_ERROR_LIBRARY, // |
| 60 | @Meta(def = "Importing from URL", format = Format.STRING, description = "the title of the 'import URL' dialogue") |
| 61 | TITLE_IMPORT_URL, // |
| 62 | @Meta(def = "URL of the story to import:", format = Format.STRING, description = "the subtitle of the 'import URL' dialogue") |
| 63 | SUBTITLE_IMPORT_URL, // |
| 64 | @Meta(def = "Error", format = Format.STRING, description = "the title of general error dialogues") |
| 65 | TITLE_ERROR, // |
| 66 | @Meta(def = "%s: %s", format = Format.STRING, description = "the title of a story for the properties dialogue, the viewers...", info = "%s = LUID of the story, %s = title of the story") |
| 67 | TITLE_STORY, // |
| 68 | |
| 69 | // |
| 70 | |
| 71 | @Meta(def = "A new version of the program is available at %s", format = Format.STRING, description = "HTML text used to notify of a new version", info = "%s = url link in HTML") |
| 72 | NEW_VERSION_AVAILABLE, // |
| 73 | @Meta(def = "Updates available", format = Format.STRING, description = "text used as title for the update dialogue") |
| 74 | NEW_VERSION_TITLE, // |
| 75 | @Meta(def = "Version %s", format = Format.STRING, description = "HTML text used to specify a newer version title and number, used for each version newer than the current one", info = "%s = the newer version number") |
| 76 | NEW_VERSION_VERSION, // |
| 77 | @Meta(def = "%s words", format = Format.STRING, description = "show the number of words of a book", info = "%s = the number") |
| 78 | BOOK_COUNT_WORDS, // |
| 79 | @Meta(def = "%s images", format = Format.STRING, description = "show the number of images of a book", info = "%s = the number") |
| 80 | BOOK_COUNT_IMAGES, // |
| 81 | @Meta(def = "%s stories", format = Format.STRING, description = "show the number of stories of a meta-book (a book representing allthe types/sources or all the authors present)", info = "%s = the number") |
| 82 | BOOK_COUNT_STORIES, // |
| 83 | |
| 84 | // Menu (and popup) items: |
| 85 | |
| 86 | @Meta(def = "File", format = Format.STRING, description = "the file menu") |
| 87 | MENU_FILE, // |
| 88 | @Meta(def = "Exit", format = Format.STRING, description = "the file/exit menu button") |
| 89 | MENU_FILE_EXIT, // |
| 90 | @Meta(def = "Import File...", format = Format.STRING, description = "the file/import_file menu button") |
| 91 | MENU_FILE_IMPORT_FILE, // |
| 92 | @Meta(def = "Import URL...", format = Format.STRING, description = "the file/import_url menu button") |
| 93 | MENU_FILE_IMPORT_URL, // |
| 94 | @Meta(def = "Save as...", format = Format.STRING, description = "the file/export menu button") |
| 95 | MENU_FILE_EXPORT, // |
| 96 | @Meta(def = "Move to", format = Format.STRING, description = "the file/move to menu button") |
| 97 | MENU_FILE_MOVE_TO, // |
| 98 | @Meta(def = "Set author", format = Format.STRING, description = "the file/set author menu button") |
| 99 | MENU_FILE_SET_AUTHOR, // |
| 100 | @Meta(def = "New source...", format = Format.STRING, description = "the file/move to/new type-source menu button, that will trigger a dialogue to create a new type/source") |
| 101 | MENU_FILE_MOVE_TO_NEW_TYPE, // |
| 102 | @Meta(def = "New author...", format = Format.STRING, description = "the file/move to/new author menu button, that will trigger a dialogue to create a new author") |
| 103 | MENU_FILE_MOVE_TO_NEW_AUTHOR, // |
| 104 | @Meta(def = "Rename...", format = Format.STRING, description = "the file/rename menu item, that will trigger a dialogue to ask for a new title for the story") |
| 105 | MENU_FILE_RENAME, // |
| 106 | @Meta(def = "Properties", format = Format.STRING, description = "the file/Properties menu item, that will trigger a dialogue to show the properties of the story") |
| 107 | MENU_FILE_PROPERTIES, // |
| 108 | @Meta(def = "Open", format = Format.STRING, description = "the file/open menu item, that will open the story or fake-story (an author or a source/type)") |
| 109 | MENU_FILE_OPEN, // |
| 110 | @Meta(def = "Edit", format = Format.STRING, description = "the edit menu") |
| 111 | MENU_EDIT, // |
| 112 | @Meta(def = "Clear cache", format = Format.STRING, description = "the clear cache menu button, to clear the cache for a single book") |
| 113 | MENU_EDIT_CLEAR_CACHE, // |
| 114 | @Meta(def = "Redownload", format = Format.STRING, description = "the edit/redownload menu button, to download the latest version of the book") |
| 115 | MENU_EDIT_REDOWNLOAD, // |
| 116 | @Meta(def = "Delete", format = Format.STRING, description = "the edit/delete menu button") |
| 117 | MENU_EDIT_DELETE, // |
| 118 | @Meta(def = "Set as cover for source", format = Format.STRING, description = "the edit/Set as cover for source menu button") |
| 119 | MENU_EDIT_SET_COVER_FOR_SOURCE, // |
| 120 | @Meta(def = "Set as cover for author", format = Format.STRING, description = "the edit/Set as cover for author menu button") |
| 121 | MENU_EDIT_SET_COVER_FOR_AUTHOR, // |
| 122 | @Meta(def = "Search", format = Format.STRING, description = "the search menu to open the earch stories on one of the searchable websites") |
| 123 | MENU_SEARCH, |
| 124 | @Meta(def = "View", format = Format.STRING, description = "the view menu") |
| 125 | MENU_VIEW, // |
| 126 | @Meta(def = "Word count", format = Format.STRING, description = "the view/word_count menu button, to show the word/image/story count as secondary info") |
| 127 | MENU_VIEW_WCOUNT, // |
| 128 | @Meta(def = "Author", format = Format.STRING, description = "the view/author menu button, to show the author as secondary info") |
| 129 | MENU_VIEW_AUTHOR, // |
| 130 | @Meta(def = "Sources", format = Format.STRING, description = "the sources menu, to select the books from a specific source; also used as a title for the source books") |
| 131 | MENU_SOURCES, // |
| 132 | @Meta(def = "Authors", format = Format.STRING, description = "the authors menu, to select the books of a specific author; also used as a title for the author books") |
| 133 | MENU_AUTHORS, // |
| 134 | @Meta(def = "Options", format = Format.STRING, description = "the options menu, to configure Fanfix from the GUI") |
| 135 | MENU_OPTIONS, // |
| 136 | @Meta(def = "All", format = Format.STRING, description = "a special menu button to select all the sources/types or authors, by group (one book = one group)") |
| 137 | MENU_XXX_ALL_GROUPED, // |
| 138 | @Meta(def = "Listing", format = Format.STRING, description = "a special menu button to select all the sources/types or authors, in a listing (all the included books are listed, grouped by source/type or author)") |
| 139 | MENU_XXX_ALL_LISTING, // |
| 140 | @Meta(def = "[unknown]", format = Format.STRING, description = "a special menu button to select the books without author") |
| 141 | MENU_AUTHORS_UNKNOWN, // |
| 142 | |
| 143 | // Progress names |
| 144 | @Meta(def = "Reload books", format = Format.STRING, description = "progress bar caption for the 'reload books' step of all outOfUi operations") |
| 145 | PROGRESS_OUT_OF_UI_RELOAD_BOOKS, // |
| 146 | @Meta(def = "Change the source of the book to %s", format = Format.STRING, description = "progress bar caption for the 'change source' step of the ReDownload operation", info = "%s = new source name") |
| 147 | PROGRESS_CHANGE_SOURCE, // |
| 148 | |
| 149 | // Error messages |
| 150 | @Meta(def = "An error occured when contacting the library", format = Format.STRING, description = "default description if the error is not known") |
| 151 | ERROR_LIB_STATUS, // |
| 152 | @Meta(def = "You are not allowed to access this library", format = Format.STRING, description = "library access not allowed") |
| 153 | ERROR_LIB_STATUS_UNAUTORIZED, // |
| 154 | @Meta(def = "Library not valid", format = Format.STRING, description = "the library is invalid (not correctly set up)") |
| 155 | ERROR_LIB_STATUS_INVALID, // |
| 156 | @Meta(def = "Library currently unavailable", format = Format.STRING, description = "the library is out of commission") |
| 157 | ERROR_LIB_STATUS_UNAVAILABLE, // |
| 158 | @Meta(def = "Cannot open the selected book", format = Format.STRING, description = "cannot open the book, internal or external viewer") |
| 159 | ERROR_CANNOT_OPEN, // |
| 160 | @Meta(def = "URL not supported: %s", format = Format.STRING, description = "URL is not supported by Fanfix", info = "%s = URL") |
| 161 | ERROR_URL_NOT_SUPPORTED, // |
| 162 | @Meta(def = "Failed to import %s:\n%s", format = Format.STRING, description = "cannot import the URL", info = "%s = URL, %s = reasons") |
| 163 | ERROR_URL_IMPORT_FAILED, |
| 164 | |
| 165 | // Others |
| 166 | @Meta(def = " <B>Chapitre <SPAN COLOR='#444466'>%d</SPAN> / %d</B>", format = Format.STRING, description = "(html) the chapter progression value used on the viewers", info = "%d = chapter number, %d = total chapters") |
| 167 | CHAPTER_HTML_UNNAMED, // |
| 168 | @Meta(def = " <B>Chapitre <SPAN COLOR='#444466'>%d</SPAN> / %d</B>: %s", format = Format.STRING, description = "(html) the chapter progression value used on the viewers", info = "%d = chapter number, %d = total chapters, %s = chapter name") |
| 169 | CHAPTER_HTML_NAMED, // |
| 170 | @Meta(def = "Image %d / %d", format = Format.STRING, description = "(NO html) the chapter progression value used on the viewers", info = "%d = current image number, %d = total images") |
| 171 | IMAGE_PROGRESSION, // |
| 172 | |
| 173 | ; |
| 174 | |
| 175 | /** |
| 176 | * Write the header found in the configuration <tt>.properties</tt> file of |
| 177 | * this {@link Bundle}. |
| 178 | * |
| 179 | * @param writer |
| 180 | * the {@link Writer} to write the header in |
| 181 | * @param name |
| 182 | * the file name |
| 183 | * |
| 184 | * @throws IOException |
| 185 | * in case of IO error |
| 186 | */ |
| 187 | static public void writeHeader(Writer writer, String name) |
| 188 | throws IOException { |
| 189 | writer.write("# " + name + " translation file (UTF-8)\n"); |
| 190 | writer.write("# \n"); |
| 191 | writer.write("# Note that any key can be doubled with a _NOUTF suffix\n"); |
| 192 | writer.write("# to use when the NOUTF env variable is set to 1\n"); |
| 193 | writer.write("# \n"); |
| 194 | writer.write("# Also, the comments always refer to the key below them.\n"); |
| 195 | writer.write("# \n"); |
| 196 | } |
| 197 | } |