| 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 = "Prefetch to cache", format = Format.STRING, description = "the edit/send to cache menu button, to download the story into the cache if not already done") |
| 113 | MENU_EDIT_DOWNLOAD_TO_CACHE, // |
| 114 | @Meta(def = "Clear cache", format = Format.STRING, description = "the clear cache menu button, to clear the cache for a single book") |
| 115 | MENU_EDIT_CLEAR_CACHE, // |
| 116 | @Meta(def = "Redownload", format = Format.STRING, description = "the edit/redownload menu button, to download the latest version of the book") |
| 117 | MENU_EDIT_REDOWNLOAD, // |
| 118 | @Meta(def = "Delete", format = Format.STRING, description = "the edit/delete menu button") |
| 119 | MENU_EDIT_DELETE, // |
| 120 | @Meta(def = "Set as cover for source", format = Format.STRING, description = "the edit/Set as cover for source menu button") |
| 121 | MENU_EDIT_SET_COVER_FOR_SOURCE, // |
| 122 | @Meta(def = "Set as cover for author", format = Format.STRING, description = "the edit/Set as cover for author menu button") |
| 123 | MENU_EDIT_SET_COVER_FOR_AUTHOR, // |
| 124 | @Meta(def = "Search", format = Format.STRING, description = "the search menu to open the earch stories on one of the searchable websites") |
| 125 | MENU_SEARCH, |
| 126 | @Meta(def = "View", format = Format.STRING, description = "the view menu") |
| 127 | MENU_VIEW, // |
| 128 | @Meta(def = "Word count", format = Format.STRING, description = "the view/word_count menu button, to show the word/image/story count as secondary info") |
| 129 | MENU_VIEW_WCOUNT, // |
| 130 | @Meta(def = "Author", format = Format.STRING, description = "the view/author menu button, to show the author as secondary info") |
| 131 | MENU_VIEW_AUTHOR, // |
| 132 | @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") |
| 133 | MENU_SOURCES, // |
| 134 | @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") |
| 135 | MENU_AUTHORS, // |
| 136 | @Meta(def = "Options", format = Format.STRING, description = "the options menu, to configure Fanfix from the GUI") |
| 137 | MENU_OPTIONS, // |
| 138 | @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)") |
| 139 | MENU_XXX_ALL_GROUPED, // |
| 140 | @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)") |
| 141 | MENU_XXX_ALL_LISTING, // |
| 142 | @Meta(def = "[unknown]", format = Format.STRING, description = "a special menu button to select the books without author") |
| 143 | MENU_AUTHORS_UNKNOWN, // |
| 144 | |
| 145 | // Progress names |
| 146 | @Meta(def = "Reload books", format = Format.STRING, description = "progress bar caption for the 'reload books' step of all outOfUi operations") |
| 147 | PROGRESS_OUT_OF_UI_RELOAD_BOOKS, // |
| 148 | @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") |
| 149 | PROGRESS_CHANGE_SOURCE, // |
| 150 | |
| 151 | // Error messages |
| 152 | @Meta(def = "An error occured when contacting the library", format = Format.STRING, description = "default description if the error is not known") |
| 153 | ERROR_LIB_STATUS, // |
| 154 | @Meta(def = "You are not allowed to access this library", format = Format.STRING, description = "library access not allowed") |
| 155 | ERROR_LIB_STATUS_UNAUTHORIZED, // |
| 156 | @Meta(def = "Library not valid", format = Format.STRING, description = "the library is invalid (not correctly set up)") |
| 157 | ERROR_LIB_STATUS_INVALID, // |
| 158 | @Meta(def = "Library currently unavailable", format = Format.STRING, description = "the library is out of commission") |
| 159 | ERROR_LIB_STATUS_UNAVAILABLE, // |
| 160 | @Meta(def = "Cannot open the selected book", format = Format.STRING, description = "cannot open the book, internal or external viewer") |
| 161 | ERROR_CANNOT_OPEN, // |
| 162 | @Meta(def = "URL not supported: %s", format = Format.STRING, description = "URL is not supported by Fanfix", info = "%s = URL") |
| 163 | ERROR_URL_NOT_SUPPORTED, // |
| 164 | @Meta(def = "Failed to import %s:\n%s", format = Format.STRING, description = "cannot import the URL", info = "%s = URL, %s = reasons") |
| 165 | ERROR_URL_IMPORT_FAILED, |
| 166 | |
| 167 | // Others |
| 168 | @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") |
| 169 | CHAPTER_HTML_UNNAMED, // |
| 170 | @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") |
| 171 | CHAPTER_HTML_NAMED, // |
| 172 | @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") |
| 173 | IMAGE_PROGRESSION, // |
| 174 | |
| 175 | ; |
| 176 | |
| 177 | /** |
| 178 | * Write the header found in the configuration <tt>.properties</tt> file of |
| 179 | * this {@link Bundle}. |
| 180 | * |
| 181 | * @param writer |
| 182 | * the {@link Writer} to write the header in |
| 183 | * @param name |
| 184 | * the file name |
| 185 | * |
| 186 | * @throws IOException |
| 187 | * in case of IO error |
| 188 | */ |
| 189 | static public void writeHeader(Writer writer, String name) |
| 190 | throws IOException { |
| 191 | writer.write("# " + name + " translation file (UTF-8)\n"); |
| 192 | writer.write("# \n"); |
| 193 | writer.write("# Note that any key can be doubled with a _NOUTF suffix\n"); |
| 194 | writer.write("# to use when the NOUTF env variable is set to 1\n"); |
| 195 | writer.write("# \n"); |
| 196 | writer.write("# Also, the comments always refer to the key below them.\n"); |
| 197 | writer.write("# \n"); |
| 198 | } |
| 199 | } |