- [x] Make use of it in gui
- [ ] Make use of it in tui
- [ ] Use it for all user output
- - [ ] French translation
+ - [x] French translation
- [x] French manual/readme
- [x] Install a mechanism to handle stories import/export progress update
- [x] Progress system
# Fanfix
+# Version WIP
+
+- gui: traduction en français
+
# Version 2.0.1
- lib: un changement de titre/source/author n'était pas toujours visible en runtime
# Fanfix
+# Version WIP
+
+- gui: translated into French
+
# Version 2.0.1
- lib: a change of title/source/author was not always visible at runtime
import be.nikiroo.fanfix.bundles.ConfigBundle;
import be.nikiroo.fanfix.bundles.StringId;
import be.nikiroo.fanfix.bundles.StringIdBundle;
+import be.nikiroo.fanfix.bundles.StringIdGuiBundle;
import be.nikiroo.fanfix.bundles.UiConfig;
import be.nikiroo.fanfix.bundles.UiConfigBundle;
import be.nikiroo.fanfix.library.BasicLibrary;
private static UiConfigBundle uiconfig;
private static StringIdBundle trans;
private static DataLoader cache;
+ private static StringIdGuiBundle transGui;
private static BasicLibrary lib;
private static File coverDir;
private static File readerTmp;
/**
* Get the (unique) {link StringIdBundle} for the program.
+ * <p>
+ * This is used for the translations of the core parts of Fanfix.
*
* @return the {link StringIdBundle}
*/
return trans;
}
+ /**
+ * Get the (unique) {link StringIdGuiBundle} for the program.
+ * <p>
+ * This is used for the translations of the GUI parts of Fanfix.
+ *
+ * @return the {link StringIdGuiBundle}
+ */
+ public static StringIdGuiBundle getTransGui() {
+ return transGui;
+ }
+
/**
* Get the (unique) {@link LocalLibrary} for the program.
*
/**
* Create the config variables ({@link Instance#config},
- * {@link Instance#uiconfig} and {@link Instance#trans}).
+ * {@link Instance#uiconfig}, {@link Instance#trans} and
+ * {@link Instance#transGui}).
*
* @param configDir
* the directory where to find the configuration files
// No updateFile for this one! (we do not want the user to have custom
// translations that won't accept updates from newer versions)
trans = new StringIdBundle(getLang());
+ transGui = new StringIdGuiBundle(getLang());
// Fix an old bug (we used to store custom translation files by
// default):
if (checkEnv("NOUTF")) {
trans.setUnicode(false);
+ transGui.setUnicode(false);
}
Bundles.setDirectory(configDir);
import be.nikiroo.utils.resources.TransBundle;
/**
- * This class manages the translation resources of the application.
+ * This class manages the translation resources of the application (Core).
*
* @author niki
*/
public class StringIdBundle extends TransBundle<StringId> {
/**
* Create a translation service for the given language (will fall back to
- * the default one i not found).
+ * the default one if not found).
*
* @param lang
* the language to use
*/
public StringIdBundle(String lang) {
- super(StringId.class, Target.resources, lang);
+ super(StringId.class, Target.resources_core, lang);
}
/**
--- /dev/null
+package be.nikiroo.fanfix.bundles;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import be.nikiroo.utils.resources.Bundle;
+import be.nikiroo.utils.resources.Meta;
+import be.nikiroo.utils.resources.Meta.Format;
+
+/**
+ * The {@link Enum} representing textual information to be translated to the
+ * user as a key.
+ *
+ * Note that each key that should be translated <b>must</b> be annotated with a
+ * {@link Meta} annotation.
+ *
+ * @author niki
+ */
+@SuppressWarnings("javadoc")
+public enum StringIdGui {
+ /**
+ * A special key used for technical reasons only, without annotations so it
+ * is not visible in <tt>.properties</tt> files.
+ * <p>
+ * Use it when you need NO translation.
+ */
+ NULL, //
+ /**
+ * A special key used for technical reasons only, without annotations so it
+ * is not visible in <tt>.properties</tt> files.
+ * <p>
+ * Use it when you need a real translation but still don't have a key.
+ */
+ DUMMY, //
+ @Meta(def = "Fanfix %s local library", format = Format.STRING, description = "the title of the main window of Fanfix, the library", info = "%s = current Fanfix version")
+ // The titles/subtitles:
+ TITLE_LIBRARY, //
+ @Meta(def = "Fanfix %s on %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")
+ TITLE_LIBRARY_WITH_NAME, //
+ @Meta(def = "Fanfix Configuration", format = Format.STRING, description = "the title of the configuration window of Fanfix, also the name of the menu button")
+ TITLE_CONFIG, //
+ @Meta(def = "This is where you configure the options of the program.", format = Format.STRING, description = "the subtitle of the configuration window of Fanfix")
+ SUBTITLE_CONFIG, //
+ @Meta(def = "UI Configuration", format = Format.STRING, description = "the title of the UI configuration window of Fanfix, also the name of the menu button")
+ TITLE_CONFIG_UI, //
+ @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")
+ SUBTITLE_CONFIG_UI, //
+ @Meta(def = "Save", format = Format.STRING, description = "the title of the 'save to/export to' window of Fanfix")
+ TITLE_SAVE, //
+ @Meta(def = "Moving story", format = Format.STRING, description = "the title of the 'move to' window of Fanfix")
+ TITLE_MOVE_TO, //
+ @Meta(def = "Move to:", format = Format.STRING, description = "the subtitle of the 'move to' window of Fanfix")
+ SUBTITLE_MOVE_TO, //
+ @Meta(def = "Delete story", format = Format.STRING, description = "the title of the 'delete' window of Fanfix")
+ TITLE_DELETE, //
+ @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")
+ SUBTITLE_DELETE, //
+ @Meta(def = "Library error", format = Format.STRING, description = "the title of the 'library error' dialogue")
+ TITLE_ERROR_LIBRARY, //
+ @Meta(def = "Importing from URL", format = Format.STRING, description = "the title of the 'import URL' dialogue")
+ TITLE_IMPORT_URL, //
+ @Meta(def = "URL of the story to import:", format = Format.STRING, description = "the subtitle of the 'import URL' dialogue")
+ SUBTITLE_IMPORT_URL, //
+ @Meta(def = "Error", format = Format.STRING, description = "the title of general error dialogues")
+ TITLE_ERROR, //
+ @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")
+ TITLE_STORY, //
+
+ //
+
+ @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")
+ NEW_VERSION_AVAILABLE, //
+ @Meta(def = "Updates available", format = Format.STRING, description = "text used as title for the update dialogue")
+ NEW_VERSION_TITLE, //
+ @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")
+ NEW_VERSION_VERSION, //
+ @Meta(def = "%s words", format = Format.STRING, description = "show the number of words of a book", info = "%s = the number")
+ BOOK_COUNT_WORDS, //
+ @Meta(def = "%s images", format = Format.STRING, description = "show the number of images of a book", info = "%s = the number")
+ BOOK_COUNT_IMAGES, //
+ @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")
+ BOOK_COUNT_STORIES, //
+
+ // Menu (and popup) items:
+
+ @Meta(def = "File", format = Format.STRING, description = "the file menu")
+ MENU_FILE, //
+ @Meta(def = "Exit", format = Format.STRING, description = "the file/exit menu button")
+ MENU_FILE_EXIT, //
+ @Meta(def = "Import File...", format = Format.STRING, description = "the file/import_file menu button")
+ MENU_FILE_IMPORT_FILE, //
+ @Meta(def = "Import URL...", format = Format.STRING, description = "the file/import_url menu button")
+ MENU_FILE_IMPORT_URL, //
+ @Meta(def = "Save as...", format = Format.STRING, description = "the file/export menu button")
+ MENU_FILE_EXPORT, //
+ @Meta(def = "Move to", format = Format.STRING, description = "the file/move to menu button")
+ MENU_FILE_MOVE_TO, //
+ @Meta(def = "Set author", format = Format.STRING, description = "the file/set author menu button")
+ MENU_FILE_SET_AUTHOR, //
+ @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")
+ MENU_FILE_MOVE_TO_NEW_TYPE, //
+ @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")
+ MENU_FILE_MOVE_TO_NEW_AUTHOR, //
+ @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")
+ MENU_FILE_RENAME, //
+ @Meta(def = "Properties", format = Format.STRING, description = "the file/Properties menu item, that will trigger a dialogue to show the properties of the story")
+ MENU_FILE_PROPERTIES, //
+ @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)")
+ MENU_FILE_OPEN, //
+ @Meta(def = "Edit", format = Format.STRING, description = "the edit menu")
+ MENU_EDIT, //
+ @Meta(def = "Clear cache", format = Format.STRING, description = "the clear cache menu button, to clear the cache for a single book")
+ MENU_EDIT_CLEAR_CACHE, //
+ @Meta(def = "Redownload", format = Format.STRING, description = "the edit/redownload menu button, to download the latest version of the book")
+ MENU_EDIT_REDOWNLOAD, //
+ @Meta(def = "Delete", format = Format.STRING, description = "the edit/delete menu button")
+ MENU_EDIT_DELETE, //
+ @Meta(def = "Set as cover for source", format = Format.STRING, description = "the edit/Set as cover for source menu button")
+ MENU_EDIT_SET_COVER_FOR_SOURCE, //
+ @Meta(def = "Set as cover for author", format = Format.STRING, description = "the edit/Set as cover for author menu button")
+ MENU_EDIT_SET_COVER_FOR_AUTHOR, //
+ @Meta(def = "View", format = Format.STRING, description = "the view menu")
+ MENU_VIEW, //
+ @Meta(def = "Word count", format = Format.STRING, description = "the view/word_count menu button, to show the word/image/story count as secondary info")
+ MENU_VIEW_WCOUNT, //
+ @Meta(def = "Author", format = Format.STRING, description = "the view/author menu button, to show the author as secondary info")
+ MENU_VIEW_AUTHOR, //
+ @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")
+ MENU_SOURCES, //
+ @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")
+ MENU_AUTHORS, //
+ @Meta(def = "Options", format = Format.STRING, description = "the options menu, to configure Fanfix from the GUI")
+ MENU_OPTIONS, //
+ @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)")
+ MENU_XXX_ALL_GROUPED, //
+ @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)")
+ MENU_XXX_ALL_LISTING, //
+ @Meta(def = "[unknown]", format = Format.STRING, description = "a special menu button to select the books without author")
+ MENU_AUTHORS_UNKNOWN, //
+
+ // Progress names
+ @Meta(def = "Removing old copy", format = Format.STRING, description = "progress bar caption for the 'removing old copy' step of 'redownload'")
+ PROGRESS_REDOWNLOAD_REMOVE_OLD_COPY, //
+ @Meta(def = "Reload books", format = Format.STRING, description = "progress bar caption for the 'reload books' step of all outOfUi operations")
+ PROGRESS_OUT_OF_UI_RELOAD_BOOKS, //
+
+ // Error messages
+ @Meta(def = "An error occured when contacting the library", format = Format.STRING, description = "default description if the error is not known")
+ ERROR_LIB_STATUS, //
+ @Meta(def = "You are not allowed to access this library", format = Format.STRING, description = "library access not allowed")
+ ERROR_LIB_STATUS_UNAUTORIZED, //
+ @Meta(def = "Library not valid", format = Format.STRING, description = "the library is invalid (not correctly set up)")
+ ERROR_LIB_STATUS_INVALID, //
+ @Meta(def = "Library currently unavailable", format = Format.STRING, description = "the library is out of commission")
+ ERROR_LIB_STATUS_UNAVAILABLE, //
+ @Meta(def = "Cannot open the selected book", format = Format.STRING, description = "cannot open the book, internal or external viewer")
+ ERROR_CANNOT_OPEN, //
+ @Meta(def = "URL not supported: %s", format = Format.STRING, description = "URL is not supported by Fanfix", info = "%s = URL")
+ ERROR_URL_NOT_SUPPORTED, //
+ @Meta(def = "Failed to import %s:\n%s", format = Format.STRING, description = "cannot import the URL", info = "%s = URL, %s = reasons")
+ ERROR_URL_IMPORT_FAILED,
+
+ // Others
+ @Meta(def = " <B>Chapter <P COLOR='#7777DD'>%d</P>/%d</B>", format = Format.STRING, description = "(html) the chapter progression value used on the viewers", info = "%d = chapter number, %d = total chapters")
+ CHAPTER_HTML_UNNAMED, //
+ @Meta(def = " <B>Chapter <P COLOR='#7777DD'>%d</P>/%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")
+ CHAPTER_HTML_NAMED, //
+ @Meta(def = "Image <P COLOR='#7777DD'>%d</P>/%d", format = Format.STRING, description = "(html) the chapter progression value used on the viewers", info = "%d = currnt image number, %d = total images")
+ IMAGE_PROGRESSION, //
+
+ ;
+
+ /**
+ * Write the header found in the configuration <tt>.properties</tt> file of
+ * this {@link Bundle}.
+ *
+ * @param writer
+ * the {@link Writer} to write the header in
+ * @param name
+ * the file name
+ *
+ * @throws IOException
+ * in case of IO error
+ */
+ static public void writeHeader(Writer writer, String name)
+ throws IOException {
+ writer.write("# " + name + " translation file (UTF-8)\n");
+ writer.write("# \n");
+ writer.write("# Note that any key can be doubled with a _NOUTF suffix\n");
+ writer.write("# to use when the NOUTF env variable is set to 1\n");
+ writer.write("# \n");
+ writer.write("# Also, the comments always refer to the key below them.\n");
+ writer.write("# \n");
+ }
+}
--- /dev/null
+package be.nikiroo.fanfix.bundles;
+
+import java.io.File;
+import java.io.IOException;
+
+import be.nikiroo.utils.resources.TransBundle;
+
+/**
+ * This class manages the translation resources of the application (GUI).
+ *
+ * @author niki
+ */
+public class StringIdGuiBundle extends TransBundle<StringIdGui> {
+ /**
+ * Create a translation service for the given language (will fall back to
+ * the default one if not found).
+ *
+ * @param lang
+ * the language to use
+ */
+ public StringIdGuiBundle(String lang) {
+ super(StringIdGui.class, Target.resources_gui, lang);
+ }
+
+ /**
+ * Update resource file.
+ *
+ * @param args
+ * not used
+ *
+ * @throws IOException
+ * in case of I/O error
+ */
+ public static void main(String[] args) throws IOException {
+ String path = new File(".").getAbsolutePath()
+ + "/src/be/nikiroo/fanfix/bundles/";
+ new StringIdGuiBundle(null).updateFile(path);
+ System.out.println("Path updated: " + path);
+ }
+}
* <tt>.properties</tt> file
*/
config,
- /** Translation resources */
- resources,
+ /** Translation resources (Core) */
+ resources_core,
+ /** Translation resources (GUI) */
+ resources_gui,
/** UI resources (from colours to behaviour) */
ui,
/** Description of UI resources. */
--- /dev/null
+# United States (en_US) resources_gui translation file (UTF-8)
+#
+# Note that any key can be doubled with a _NOUTF suffix
+# to use when the NOUTF env variable is set to 1
+#
+# Also, the comments always refer to the key below them.
+#
+
+
+# the title of the main window of Fanfix, the library
+# (FORMAT: STRING) %s = current Fanfix version
+TITLE_LIBRARY = Fanfix %s local library
+# the title of the main window of Fanfix, the library, when the library has a name (i.e., is not local)
+# (FORMAT: STRING) %s = current Fanfix version, %s = library name
+TITLE_LIBRARY_WITH_NAME = Fanfix %s on %s
+# the title of the configuration window of Fanfix, also the name of the menu button
+# (FORMAT: STRING)
+TITLE_CONFIG = Fanfix Configuration
+# the subtitle of the configuration window of Fanfix
+# (FORMAT: STRING)
+SUBTITLE_CONFIG = This is where you configure the options of the program.
+# the title of the UI configuration window of Fanfix, also the name of the menu button
+# (FORMAT: STRING)
+TITLE_CONFIG_UI = UI Configuration
+# the subtitle of the UI configuration window of Fanfix
+# (FORMAT: STRING)
+SUBTITLE_CONFIG_UI = This is where you configure the graphical appearence of the program.
+# the title of the 'save to/export to' window of Fanfix
+# (FORMAT: STRING)
+TITLE_SAVE = Save
+# the title of the 'move to' window of Fanfix
+# (FORMAT: STRING)
+TITLE_MOVE_TO = Moving story
+# the subtitle of the 'move to' window of Fanfix
+# (FORMAT: STRING)
+SUBTITLE_MOVE_TO = Move to:
+# the title of the 'delete' window of Fanfix
+# (FORMAT: STRING)
+TITLE_DELETE = Delete story
+# the subtitle of the 'delete' window of Fanfix
+# (FORMAT: STRING) %s = LUID of the story, %s = title of the story
+SUBTITLE_DELETE = Delete %s: %s
+# the title of the 'library error' dialogue
+# (FORMAT: STRING)
+TITLE_ERROR_LIBRARY = Library error
+# the title of the 'import URL' dialogue
+# (FORMAT: STRING)
+TITLE_IMPORT_URL = Importing from URL
+# the subtitle of the 'import URL' dialogue
+# (FORMAT: STRING)
+SUBTITLE_IMPORT_URL = URL of the story to import:
+# the title of general error dialogues
+# (FORMAT: STRING)
+TITLE_ERROR = Error
+# the title of a story for the properties dialogue, the viewers...
+# (FORMAT: STRING) %s = LUID of the story, %s = title of the story
+TITLE_STORY = %s: %s
+# HTML text used to notify of a new version
+# (FORMAT: STRING) %s = url link in HTML
+NEW_VERSION_AVAILABLE = A new version of the program is available at %s
+# text used as title for the update dialogue
+# (FORMAT: STRING)
+NEW_VERSION_TITLE = Updates available
+# HTML text used to specify a newer version title and number, used for each version newer than the current one
+# (FORMAT: STRING) %s = the newer version number
+NEW_VERSION_VERSION = Version %s
+# show the number of words of a book
+# (FORMAT: STRING) %s = the number
+BOOK_COUNT_WORDS = %s words
+# show the number of images of a book
+# (FORMAT: STRING) %s = the number
+BOOK_COUNT_IMAGES = %s images
+# show the number of stories of a meta-book (a book representing allthe types/sources or all the authors present)
+# (FORMAT: STRING) %s = the number
+BOOK_COUNT_STORIES = %s stories
+# the file menu (FORMAT: STRING)
+MENU_FILE = File
+# the file/exit menu button
+# (FORMAT: STRING)
+MENU_FILE_EXIT = Exit
+# the file/import_file menu button
+# (FORMAT: STRING)
+MENU_FILE_IMPORT_FILE = Import File...
+# the file/import_url menu button
+# (FORMAT: STRING)
+MENU_FILE_IMPORT_URL = Import URL...
+# the file/export menu button
+# (FORMAT: STRING)
+MENU_FILE_EXPORT = Save as...
+# the file/move to menu button
+# (FORMAT: STRING)
+MENU_FILE_MOVE_TO = Move to
+# the file/set author menu button
+# (FORMAT: STRING)
+MENU_FILE_SET_AUTHOR = Set author
+# the file/move to/new type-source menu button, that will trigger a dialogue to create a new type/source
+# (FORMAT: STRING)
+MENU_FILE_MOVE_TO_NEW_TYPE = New source...
+# the file/move to/new author menu button, that will trigger a dialogue to create a new author
+# (FORMAT: STRING)
+MENU_FILE_MOVE_TO_NEW_AUTHOR = New author...
+# the file/rename menu item, that will trigger a dialogue to ask for a new title for the story
+# (FORMAT: STRING)
+MENU_FILE_RENAME = Rename...
+# the file/Properties menu item, that will trigger a dialogue to show the properties of the story
+# (FORMAT: STRING)
+MENU_FILE_PROPERTIES = Properties
+# the file/open menu item, that will open the story or fake-story (an author or a source/type)
+# (FORMAT: STRING)
+MENU_FILE_OPEN = Open
+# the edit menu (FORMAT: STRING)
+MENU_EDIT = Edit
+# the clear cache menu button, to clear the cache for a single book
+# (FORMAT: STRING)
+MENU_EDIT_CLEAR_CACHE = Clear cache
+# the edit/redownload menu button, to download the latest version of the book
+# (FORMAT: STRING)
+MENU_EDIT_REDOWNLOAD = Redownload
+# the edit/delete menu button
+# (FORMAT: STRING)
+MENU_EDIT_DELETE = Delete
+# the edit/Set as cover for source menu button
+# (FORMAT: STRING)
+MENU_EDIT_SET_COVER_FOR_SOURCE = Set as cover for source
+# the edit/Set as cover for author menu button
+# (FORMAT: STRING)
+MENU_EDIT_SET_COVER_FOR_AUTHOR = Set as cover for author
+# the view menu (FORMAT: STRING)
+MENU_VIEW = View
+# the view/word_count menu button, to show the word/image/story count as secondary info
+# (FORMAT: STRING)
+MENU_VIEW_WCOUNT = Word count
+# the view/author menu button, to show the author as secondary info
+# (FORMAT: STRING)
+MENU_VIEW_AUTHOR = Author
+# the sources menu, to select the books from a specific source; also used as a title for the source books
+# (FORMAT: STRING)
+MENU_SOURCES = Sources
+# the authors menu, to select the books of a specific author; also used as a title for the author books
+# (FORMAT: STRING)
+MENU_AUTHORS = Authors
+# the options menu, to configure Fanfix from the GUI
+# (FORMAT: STRING)
+MENU_OPTIONS = Options
+# a special menu button to select all the sources/types or authors, by group (one book = one group)
+# (FORMAT: STRING)
+MENU_XXX_ALL_GROUPED = All
+# 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)
+# (FORMAT: STRING)
+MENU_XXX_ALL_LISTING = Listing
+# a special menu button to select the books without author
+# (FORMAT: STRING)
+MENU_AUTHORS_UNKNOWN = [unknown]
+# progress bar caption for the 'removing old copy' step of 'redownload'
+# (FORMAT: STRING)
+PROGRESS_REDOWNLOAD_REMOVE_OLD_COPY = Removing old copy
+# progress bar caption for the 'reload books' step of all outOfUi operations
+# (FORMAT: STRING)
+PROGRESS_OUT_OF_UI_RELOAD_BOOKS = Reload books
+# default description if the error is not known
+# (FORMAT: STRING)
+ERROR_LIB_STATUS = An error occured when contacting the library
+# library access not allowed
+# (FORMAT: STRING)
+ERROR_LIB_STATUS_UNAUTORIZED = You are not allowed to access this library
+# the library is invalid (not correctly set up)
+# (FORMAT: STRING)
+ERROR_LIB_STATUS_INVALID = Library not valid
+# the library is out of commission
+# (FORMAT: STRING)
+ERROR_LIB_STATUS_UNAVAILABLE = Library currently unavailable
+# cannot open the book, internal or external viewer
+# (FORMAT: STRING)
+ERROR_CANNOT_OPEN = Cannot open the selected book
+# URL is not supported by Fanfix
+# (FORMAT: STRING) %s = URL
+ERROR_URL_NOT_SUPPORTED = URL not supported: %s
+# cannot import the URL
+# (FORMAT: STRING) %s = URL, %s = reasons
+ERROR_URL_IMPORT_FAILED = Failed to import %s:\n\
+%s
+# (html) the chapter progression value used on the viewers
+# (FORMAT: STRING) %d = chapter number, %d = total chapters
+CHAPTER_HTML_UNNAMED = <B>Chapter <P COLOR='#7777DD'>%d</P>/%d</B>
+# (html) the chapter progression value used on the viewers
+# (FORMAT: STRING) %d = chapter number, %d = total chapters, %s = chapter name
+CHAPTER_HTML_NAMED = <B>Chapter <P COLOR='#7777DD'>%d</P>/%d</B>: %s
+# (html) the chapter progression value used on the viewers
+# (FORMAT: STRING) %d = currnt image number, %d = total images
+IMAGE_PROGRESSION = Image <P COLOR='#7777DD'>%d</P>/%d
--- /dev/null
+# français (fr) resources_gui translation file (UTF-8)
+#
+# Note that any key can be doubled with a _NOUTF suffix
+# to use when the NOUTF env variable is set to 1
+#
+# Also, the comments always refer to the key below them.
+#
+
+
+# the title of the main window of Fanfix, the library
+# (FORMAT: STRING) %s = current Fanfix version
+TITLE_LIBRARY = Fanfix %s librairie locale
+# the title of the main window of Fanfix, the library, when the library has a name (i.e., is not local)
+# (FORMAT: STRING) %s = current Fanfix version, %s = library name
+TITLE_LIBRARY_WITH_NAME = Fanfix %s sur %s
+# the title of the configuration window of Fanfix, also the name of the menu button
+# (FORMAT: STRING)
+TITLE_CONFIG = Configuration de Fanfix
+# the subtitle of the configuration window of Fanfix
+# (FORMAT: STRING)
+SUBTITLE_CONFIG = C'est ici que vous pouvez configurer les options du programme.
+# the title of the UI configuration window of Fanfix, also the name of the menu button
+# (FORMAT: STRING)
+TITLE_CONFIG_UI = Configuration de l'interface
+# the subtitle of the UI configuration window of Fanfix
+# (FORMAT: STRING)
+SUBTITLE_CONFIG_UI = C'est ici que vous pouvez configurer les options de l'apparence de l'application.
+# the title of the 'save to/export to' window of Fanfix
+# (FORMAT: STRING)
+TITLE_SAVE = Sauver
+# the title of the 'move to' window of Fanfix
+# (FORMAT: STRING)
+TITLE_MOVE_TO = Déplacer le livre
+# the subtitle of the 'move to' window of Fanfix
+# (FORMAT: STRING)
+SUBTITLE_MOVE_TO = Déplacer vers :
+# the title of the 'delete' window of Fanfix
+# (FORMAT: STRING)
+TITLE_DELETE = Supprimer le livre
+# the subtitle of the 'delete' window of Fanfix
+# (FORMAT: STRING) %s = LUID of the story, %s = title of the story
+SUBTITLE_DELETE = Supprimer %s : %s
+# the title of the 'library error' dialogue
+# (FORMAT: STRING)
+TITLE_ERROR_LIBRARY = Erreur avec la librairie
+# the title of the 'import URL' dialogue
+# (FORMAT: STRING)
+TITLE_IMPORT_URL = Importer depuis une URL
+# the subtitle of the 'import URL' dialogue
+# (FORMAT: STRING)
+SUBTITLE_IMPORT_URL = L'URL du livre à importer
+# the title of general error dialogues
+# (FORMAT: STRING)
+TITLE_ERROR = Error
+# the title of a story for the properties dialogue, the viewers...
+# (FORMAT: STRING) %s = LUID of the story, %s = title of the story
+TITLE_STORY = %s: %s
+# HTML text used to notify of a new version
+# (FORMAT: STRING) %s = url link in HTML
+NEW_VERSION_AVAILABLE = Une nouvelle version du programme est disponible sur %s
+# text used as title for the update dialogue
+# (FORMAT: STRING)
+NEW_VERSION_TITLE = Mise-à-jour disponible
+# HTML text used to specify a newer version title and number, used for each version newer than the current one
+# (FORMAT: STRING) %s = the newer version number
+NEW_VERSION_VERSION = Version %s
+# show the number of words of a book
+# (FORMAT: STRING) %s = the number
+BOOK_COUNT_WORDS = %s mots
+# show the number of images of a book
+# (FORMAT: STRING) %s = the number
+BOOK_COUNT_IMAGES = %s images
+# show the number of stories of a meta-book (a book representing allthe types/sources or all the authors present)
+# (FORMAT: STRING) %s = the number
+BOOK_COUNT_STORIES = %s livres
+# the file menu (FORMAT: STRING)
+MENU_FILE = Fichier
+# the file/exit menu button
+# (FORMAT: STRING)
+MENU_FILE_EXIT = Quiter
+# the file/import_file menu button
+# (FORMAT: STRING)
+MENU_FILE_IMPORT_FILE = Importer un fichier...
+# the file/import_url menu button
+# (FORMAT: STRING)
+MENU_FILE_IMPORT_URL = Importer une URL...
+# the file/export menu button
+# (FORMAT: STRING)
+MENU_FILE_EXPORT = Sauver sous...
+# the file/move to menu button
+# (FORMAT: STRING)
+MENU_FILE_MOVE_TO = Déplacer vers
+# the file/set author menu button
+# (FORMAT: STRING)
+MENU_FILE_SET_AUTHOR = Changer l'auteur
+# the file/move to/new type-source menu button, that will trigger a dialogue to create a new type/source
+# (FORMAT: STRING)
+MENU_FILE_MOVE_TO_NEW_TYPE = Nouvelle source...
+# the file/move to/new author menu button, that will trigger a dialogue to create a new author
+# (FORMAT: STRING)
+MENU_FILE_MOVE_TO_NEW_AUTHOR = Nouvel auteur...
+# the file/rename menu item, that will trigger a dialogue to ask for a new title for the story
+# (FORMAT: STRING)
+MENU_FILE_RENAME = Renommer...
+# the file/Properties menu item, that will trigger a dialogue to show the properties of the story
+# (FORMAT: STRING)
+MENU_FILE_PROPERTIES = Propriétés
+# the file/open menu item, that will open the story or fake-story (an author or a source/type)
+# (FORMAT: STRING)
+MENU_FILE_OPEN = Ouvrir
+# the edit menu (FORMAT: STRING)
+MENU_EDIT = Edition
+# the clear cache menu button, to clear the cache for a single book
+# (FORMAT: STRING)
+MENU_EDIT_CLEAR_CACHE = Nettoyer le cache
+# the edit/redownload menu button, to download the latest version of the book
+# (FORMAT: STRING)
+MENU_EDIT_REDOWNLOAD = Re-downloader
+# the edit/delete menu button
+# (FORMAT: STRING)
+MENU_EDIT_DELETE = Supprimer
+# the edit/Set as cover for source menu button
+# (FORMAT: STRING)
+MENU_EDIT_SET_COVER_FOR_SOURCE = Utiliser comme cover pour la source
+# the edit/Set as cover for author menu button
+# (FORMAT: STRING)
+MENU_EDIT_SET_COVER_FOR_AUTHOR = Utiliser comme cover pour l'auteur
+# the view menu (FORMAT: STRING)
+MENU_VIEW = Affichage
+# the view/word_count menu button, to show the word/image/story count as secondary info
+# (FORMAT: STRING)
+MENU_VIEW_WCOUNT = Nombre de mots
+# the view/author menu button, to show the author as secondary info
+# (FORMAT: STRING)
+MENU_VIEW_AUTHOR = Auteur
+# the sources menu, to select the books from a specific source; also used as a title for the source books
+# (FORMAT: STRING)
+MENU_SOURCES = Sources
+# the authors menu, to select the books of a specific author; also used as a title for the author books
+# (FORMAT: STRING)
+MENU_AUTHORS = Auteurs
+# the options menu, to configure Fanfix from the GUI
+# (FORMAT: STRING)
+MENU_OPTIONS = Options
+# a special menu button to select all the sources/types or authors, by group (one book = one group)
+# (FORMAT: STRING)
+MENU_XXX_ALL_GROUPED = Tout
+# 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)
+# (FORMAT: STRING)
+MENU_XXX_ALL_LISTING = Listing
+# a special menu button to select the books without author
+# (FORMAT: STRING)
+MENU_AUTHORS_UNKNOWN = [inconnu]
+# progress bar caption for the 'removing old copy' step of 'redownload'
+# (FORMAT: STRING)
+PROGRESS_REDOWNLOAD_REMOVE_OLD_COPY = Suppression de l'ancienne version
+# progress bar caption for the 'reload books' step of all outOfUi operations
+# (FORMAT: STRING)
+PROGRESS_OUT_OF_UI_RELOAD_BOOKS = Recharger les livres
+# default description if the error is not known
+# (FORMAT: STRING)
+ERROR_LIB_STATUS = Une erreur est survenue en contactant la librairie
+# library access not allowed
+# (FORMAT: STRING)
+ERROR_LIB_STATUS_UNAUTORIZED = Vous n'étes pas autorisé à accéder à cette librairie
+# the library is invalid (not correctly set up)
+# (FORMAT: STRING)
+ERROR_LIB_STATUS_INVALID = Librairie invalide
+# the library is out of commission
+# (FORMAT: STRING)
+ERROR_LIB_STATUS_UNAVAILABLE = Librairie indisponible
+# cannot open the book, internal or external viewer
+# (FORMAT: STRING)
+ERROR_CANNOT_OPEN = Impossible d'ouvrir le livre sélectionné
+# URL is not supported by Fanfix
+# (FORMAT: STRING) %s = URL
+ERROR_URL_NOT_SUPPORTED = URL non supportée : %s
+# cannot import the URL
+# (FORMAT: STRING) %s = URL, %s = reasons
+ERROR_URL_IMPORT_FAILED = Erreur lors de l'import de %s:\n\
+%s
+# (html) the chapter progression value used on the viewers
+# (FORMAT: STRING) %d = chapter number, %d = total chapters
+CHAPTER_HTML_UNNAMED = <B>Chapitre <P COLOR='#7777DD'>%d</P>/%d</B>
+# (html) the chapter progression value used on the viewers
+# (FORMAT: STRING) %d = chapter number, %d = total chapters, %s = chapter name
+CHAPTER_HTML_NAMED = <B>Chapitre <P COLOR='#7777DD'>%d</P>/%d</B>: %s
+# (html) the chapter progression value used on the viewers
+# (FORMAT: STRING) %d = currnt image number, %d = total images
+IMAGE_PROGRESSION = Image <P COLOR='#7777DD'>%d</P>/%d
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.VersionCheck;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.bundles.UiConfig;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
final JEditorPane updateMessage = new JEditorPane("text/html", "");
if (updates.isNewVersionAvailable()) {
- builder.append("A new version of the program is available at <span style='color: blue;'>https://github.com/nikiroo/fanfix/releases</span>");
+ builder.append(trans(StringIdGui.NEW_VERSION_AVAILABLE,
+ "<span style='color: blue;'>https://github.com/nikiroo/fanfix/releases</span>"));
builder.append("<br>");
builder.append("<br>");
for (Version v : updates.getNewer()) {
- builder.append("\t<b>Version " + v + "</b>");
+ builder.append("\t<b>"
+ + trans(StringIdGui.NEW_VERSION_VERSION, v.toString())
+ + "</b>");
builder.append("<br>");
builder.append("<ul>");
for (String item : updates.getChanges().get(v)) {
public void run() {
if (updates.isNewVersionAvailable()) {
int rep = JOptionPane.showConfirmDialog(null,
- updateMessage, "Updates available",
+ updateMessage,
+ trans(StringIdGui.NEW_VERSION_TITLE),
JOptionPane.OK_CANCEL_OPTION);
if (rep == JOptionPane.OK_OPTION) {
updates.ok();
}
}
+ /**
+ * Simple shortcut method to call {link Instance#getTransGui()#getString()}.
+ *
+ * @param id
+ * the ID to translate
+ *
+ * @return the translated result
+ */
+ static String trans(StringIdGui id, Object... params) {
+ return Instance.getTransGui().getString(id, params);
+ }
+
/**
* Start a frame and wait until it is closed before returning.
*
package be.nikiroo.fanfix.reader.ui;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.data.MetaData;
+import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.library.BasicLibrary;
import be.nikiroo.utils.Image;
+/**
+ * Some meta information related to a "book" (which can either be a
+ * {@link Story}, a fake-story grouping some authors or a fake-story grouping
+ * some sources/types).
+ *
+ * @author niki
+ */
public class GuiReaderBookInfo {
public enum Type {
/** A normal story, which can be "read". */
private MetaData meta;
- // use the fromXXX methods
+ /**
+ * For private use, see the "fromXXX" constructors instead for public use.
+ *
+ * @param type
+ * the type of book
+ * @param id
+ * the main id, which must uniquely identify this book and will
+ * be used as a unique ID later on
+ * @param value
+ * the main value to show (see
+ * {@link GuiReaderBookInfo#getMainInfo()})
+ */
private GuiReaderBookInfo(Type type, String id, String value) {
this.type = type;
this.id = id;
this.value = value;
}
+ /**
+ * Get the main info to display for this book (a title, an author, a
+ * source/type name...).
+ * <p>
+ * Note that when {@link MetaData} about the book are present, the title
+ * inside is returned instead of the actual value (that way, we can update
+ * the {@link MetaData} and see the changes here).
+ *
+ * @return the main info, usually the title
+ */
public String getMainInfo() {
if (meta != null) {
return meta.getTitle();
return value;
}
+ /**
+ * Get the secondary info, of the given type.
+ *
+ * @param seeCount
+ * TRUE for word/image/story count, FALSE for author name
+ *
+ * @return the secondary info
+ */
public String getSecondaryInfo(boolean seeCount) {
String author = meta == null ? null : meta.getAuthor();
String secondaryInfo = seeCount ? count : author;
return id;
}
- // can return null for non-books
+ /**
+ * The {@link MetaData} associated with this book, if this book is a
+ * {@link Story}.
+ * <p>
+ * Can be NULL for non-story books (authors or sources/types).
+ *
+ * @return the {@link MetaData} or NULL
+ */
public MetaData getMeta() {
return meta;
}
+ /**
+ * Get the base image to use to represent this book.
+ * <p>
+ * The image is <b>NOT</b> resized in any way, this is the original version.
+ * <p>
+ * It can be NULL if no image can be found for this book.
+ *
+ * @param lib
+ * the {@link BasicLibrary} to use to fetch the image
+ *
+ * @return the base image
+ */
public Image getBaseImage(BasicLibrary lib) {
switch (type) {
case STORY:
return null;
}
+ /**
+ * Create a new book describing the given {@link Story}.
+ *
+ * @param meta
+ * the {@link MetaData} representing the {@link Story}
+ *
+ * @return the book
+ */
static public GuiReaderBookInfo fromMeta(MetaData meta) {
String uid = meta.getUuid();
if (uid == null || uid.trim().isEmpty()) {
meta.getTitle());
info.meta = meta;
- info.count = formatNumber(meta.getWords(),
- meta.isImageDocument() ? "images" : "words");
+ info.count = formatNumber(meta.getWords());
+ if (!info.count.isEmpty()) {
+ info.count = GuiReader.trans(
+ meta.isImageDocument() ? StringIdGui.BOOK_COUNT_IMAGES
+ : StringIdGui.BOOK_COUNT_WORDS, info.count);
+ }
return info;
}
+ /**
+ * Create a new book describing the given source/type.
+ *
+ * @param lib
+ * the {@link BasicLibrary} to use to retrieve some more
+ * information about the source
+ * @param source
+ * the source name
+ *
+ * @return the book
+ */
static public GuiReaderBookInfo fromSource(BasicLibrary lib, String source) {
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.SOURCE, "source_"
+ source, source);
- info.count = formatNumber(lib.getListBySource(source).size(), "stories");
+ info.count = formatNumber(lib.getListBySource(source).size());
+ if (!info.count.isEmpty()) {
+ info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES,
+ info.count);
+ }
return info;
}
+ /**
+ * Create a new book describing the given author.
+ *
+ * @param lib
+ * the {@link BasicLibrary} to use to retrieve some more
+ * information about the author
+ * @param author
+ * the author name
+ *
+ * @return the book
+ */
static public GuiReaderBookInfo fromAuthor(BasicLibrary lib, String author) {
GuiReaderBookInfo info = new GuiReaderBookInfo(Type.AUTHOR, "author_"
+ author, author);
- info.count = formatNumber(lib.getListByAuthor(author).size(), "stories");
+ info.count = formatNumber(lib.getListByAuthor(author).size());
+ if (!info.count.isEmpty()) {
+ info.count = GuiReader.trans(StringIdGui.BOOK_COUNT_STORIES,
+ info.count);
+ }
return info;
}
- static private String formatNumber(long number, String ofWhat) {
+ /**
+ * Format a number for display (use the "k" notation if higher or equal to
+ * 4000).
+ *
+ * @param number
+ * the number to parse
+ *
+ * @return the displayable version of the number
+ */
+ static private String formatNumber(long number) {
String displayNumber;
if (number >= 4000) {
displayNumber = "" + (number / 1000) + "k";
displayNumber = "";
}
- if (!displayNumber.isEmpty()) {
- displayNumber += " " + ofWhat;
- }
-
return displayNumber;
}
}
import be.nikiroo.fanfix.Instance;
import be.nikiroo.fanfix.bundles.Config;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.bundles.UiConfig;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
* the type of {@link Story} to load, or NULL for all types
*/
public GuiReaderFrame(GuiReader reader, String type) {
- super(String.format("Fanfix %s Library", Version.getCurrentVersion()));
+ super(getAppTitle(reader.getLibrary().getLibraryName()));
this.reader = reader;
JMenuBar bar = new JMenuBar();
- JMenu file = new JMenu("File");
+ JMenu file = new JMenu(GuiReader.trans(StringIdGui.MENU_FILE));
file.setMnemonic(KeyEvent.VK_F);
- JMenuItem imprt = new JMenuItem("Import URL...", KeyEvent.VK_U);
+ JMenuItem imprt = new JMenuItem(
+ GuiReader.trans(StringIdGui.MENU_FILE_IMPORT_URL),
+ KeyEvent.VK_U);
imprt.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainPanel.imprt(true);
}
});
- JMenuItem imprtF = new JMenuItem("Import File...", KeyEvent.VK_F);
+ JMenuItem imprtF = new JMenuItem(
+ GuiReader.trans(StringIdGui.MENU_FILE_IMPORT_FILE),
+ KeyEvent.VK_F);
imprtF.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mainPanel.imprt(false);
}
});
- JMenuItem exit = new JMenuItem("Exit", KeyEvent.VK_X);
+ JMenuItem exit = new JMenuItem(
+ GuiReader.trans(StringIdGui.MENU_FILE_EXIT), KeyEvent.VK_X);
exit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
file.add(createMenuItemRename(libOk));
file.add(createMenuItemSetAuthor(libOk));
file.addSeparator();
+ file.add(createMenuItemProperties());
+ file.addSeparator();
file.add(exit);
bar.add(file);
- JMenu edit = new JMenu("Edit");
+ JMenu edit = new JMenu(GuiReader.trans(StringIdGui.MENU_EDIT));
edit.setMnemonic(KeyEvent.VK_E);
+ edit.add(createMenuItemSetCoverForSource());
+ edit.add(createMenuItemSetCoverForAuthor());
edit.add(createMenuItemClearCache());
edit.add(createMenuItemRedownload());
edit.addSeparator();
bar.add(edit);
- JMenu view = new JMenu("View");
+ JMenu view = new JMenu(GuiReader.trans(StringIdGui.MENU_VIEW));
view.setMnemonic(KeyEvent.VK_V);
- JMenuItem vauthors = new JMenuItem("Author");
+ JMenuItem vauthors = new JMenuItem(
+ GuiReader.trans(StringIdGui.MENU_VIEW_AUTHOR));
vauthors.setMnemonic(KeyEvent.VK_A);
vauthors.addActionListener(new ActionListener() {
@Override
}
});
view.add(vauthors);
- JMenuItem vwords = new JMenuItem("Word count");
+ JMenuItem vwords = new JMenuItem(
+ GuiReader.trans(StringIdGui.MENU_VIEW_WCOUNT));
vwords.setMnemonic(KeyEvent.VK_W);
vwords.addActionListener(new ActionListener() {
@Override
if (libOk) {
groupedSources = reader.getLibrary().getSourcesGrouped();
}
- JMenu sources = new JMenu("Sources");
+ JMenu sources = new JMenu(GuiReader.trans(StringIdGui.MENU_SOURCES));
sources.setMnemonic(KeyEvent.VK_S);
populateMenuSA(sources, groupedSources, true);
bar.add(sources);
if (libOk) {
goupedAuthors = reader.getLibrary().getAuthorsGrouped();
}
- JMenu authors = new JMenu("Authors");
+ JMenu authors = new JMenu(GuiReader.trans(StringIdGui.MENU_AUTHORS));
authors.setMnemonic(KeyEvent.VK_A);
populateMenuSA(authors, goupedAuthors, false);
bar.add(authors);
- JMenu options = new JMenu("Options");
+ JMenu options = new JMenu(GuiReader.trans(StringIdGui.MENU_OPTIONS));
options.setMnemonic(KeyEvent.VK_O);
options.add(createMenuItemConfig());
options.add(createMenuItemUiConfig());
private void populateMenuSA(JMenu menu,
Map<String, List<String>> groupedValues, boolean type) {
- // "All" and "Listing" special items
- JMenuItem item = new JMenuItem("All");
+ // "All" and "Listing" special items first
+ JMenuItem item = new JMenuItem(GuiReader.trans(StringIdGui.MENU_XXX_ALL_GROUPED));
item.addActionListener(getActionOpenList(type, false));
menu.add(item);
- item = new JMenuItem("Listing");
+ item = new JMenuItem(GuiReader.trans(StringIdGui.MENU_XXX_ALL_LISTING));
item.addActionListener(getActionOpenList(type, true));
menu.add(item);
+
menu.addSeparator();
for (final String value : groupedValues.keySet()) {
List<String> list = groupedValues.get(value);
if (type && list.size() == 1 && list.get(0).isEmpty()) {
// leaf item source/type
- item = new JMenuItem(value.isEmpty() ? "[unknown]" : value);
+ item = new JMenuItem(value.isEmpty() ? GuiReader.trans(StringIdGui.MENU_AUTHORS_UNKNOWN) : value);
item.addActionListener(getActionOpen(value, type));
menu.add(item);
} else {
// only one group of authors
dir = menu;
} else {
- dir = new JMenu(value.isEmpty() ? "[unknown]" : value);
+ dir = new JMenu(value.isEmpty() ? GuiReader.trans(StringIdGui.MENU_AUTHORS_UNKNOWN) : value);
}
for (String sub : list) {
// " " instead of "" for the visual height
String itemName = sub;
if (itemName.isEmpty()) {
- itemName = type ? " " : "[unknown]";
+ itemName = type ? " " : GuiReader.trans(StringIdGui.MENU_AUTHORS_UNKNOWN);
}
String actualValue = value;
* @return the item
*/
private JMenuItem createMenuItemConfig() {
- final String title = "Fanfix Configuration";
+ final String title = GuiReader.trans(StringIdGui.TITLE_CONFIG);
JMenuItem item = new JMenuItem(title);
item.setMnemonic(KeyEvent.VK_F);
public void actionPerformed(ActionEvent e) {
ConfigEditor<Config> ed = new ConfigEditor<Config>(
Config.class, Instance.getConfig(),
- "This is where you configure the options of the program.");
+ GuiReader.trans(StringIdGui.SUBTITLE_CONFIG));
JFrame frame = new JFrame(title);
frame.add(ed);
frame.setSize(800, 600);
* @return the item
*/
private JMenuItem createMenuItemUiConfig() {
- final String title = "UI Configuration";
+ final String title = GuiReader.trans(StringIdGui.TITLE_CONFIG_UI);
JMenuItem item = new JMenuItem(title);
item.setMnemonic(KeyEvent.VK_U);
public void actionPerformed(ActionEvent e) {
ConfigEditor<UiConfig> ed = new ConfigEditor<UiConfig>(
UiConfig.class, Instance.getUiConfig(),
- "This is where you configure the graphical appearence of the program.");
+ GuiReader.trans(StringIdGui.SUBTITLE_CONFIG_UI));
JFrame frame = new JFrame(title);
frame.add(ed);
frame.setSize(800, 600);
}
//
- JMenuItem export = new JMenuItem("Save as...", KeyEvent.VK_S);
+ JMenuItem export = new JMenuItem(GuiReader.trans(StringIdGui.MENU_FILE_EXPORT), KeyEvent.VK_S);
export.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final GuiReaderBook selectedBook = mainPanel.getSelectedBook();
if (selectedBook != null) {
- fc.showDialog(GuiReaderFrame.this, "Save");
+ fc.showDialog(GuiReaderFrame.this, GuiReader.trans(StringIdGui.TITLE_SAVE));
if (fc.getSelectedFile() != null) {
final OutputType type = filters.get(fc.getFileFilter());
final String path = fc.getSelectedFile()
* @return the item
*/
private JMenuItem createMenuItemClearCache() {
- JMenuItem refresh = new JMenuItem("Clear cache", KeyEvent.VK_C);
+ JMenuItem refresh = new JMenuItem(GuiReader.trans(StringIdGui.MENU_EDIT_CLEAR_CACHE), KeyEvent.VK_C);
refresh.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
* @return the item
*/
private JMenuItem createMenuItemMoveTo(boolean libOk) {
- JMenu changeTo = new JMenu("Move to");
+ JMenu changeTo = new JMenu(GuiReader.trans(StringIdGui.MENU_FILE_MOVE_TO));
changeTo.setMnemonic(KeyEvent.VK_M);
Map<String, List<String>> groupedSources = new HashMap<String, List<String>>();
groupedSources = reader.getLibrary().getSourcesGrouped();
}
- JMenuItem item = new JMenuItem("New type...");
+ JMenuItem item = new JMenuItem(GuiReader.trans(StringIdGui.MENU_FILE_MOVE_TO_NEW_TYPE));
item.addActionListener(createMoveAction(ChangeAction.SOURCE, null));
changeTo.add(item);
changeTo.addSeparator();
* @return the item
*/
private JMenuItem createMenuItemSetAuthor(boolean libOk) {
- JMenu changeTo = new JMenu("Set author");
+ JMenu changeTo = new JMenu(GuiReader.trans(StringIdGui.MENU_FILE_SET_AUTHOR));
changeTo.setMnemonic(KeyEvent.VK_A);
// New author
- JMenuItem newItem = new JMenuItem("New author...");
+ JMenuItem newItem = new JMenuItem(GuiReader.trans(StringIdGui.MENU_FILE_MOVE_TO_NEW_AUTHOR));
changeTo.add(newItem);
changeTo.addSeparator();
newItem.addActionListener(createMoveAction(ChangeAction.AUTHOR, null));
JMenu group = new JMenu(key);
for (String value : groupedAuthors.get(key)) {
JMenuItem item = new JMenuItem(
- value.isEmpty() ? "[unknown]" : value);
+ value.isEmpty() ? GuiReader.trans(StringIdGui.MENU_AUTHORS_UNKNOWN) : value);
item.addActionListener(createMoveAction(
ChangeAction.AUTHOR, value));
group.add(item);
} else if (groupedAuthors.size() == 1) {
for (String value : groupedAuthors.values().iterator().next()) {
JMenuItem item = new JMenuItem(
- value.isEmpty() ? "[unknown]" : value);
+ value.isEmpty() ? GuiReader.trans(StringIdGui.MENU_AUTHORS_UNKNOWN) : value);
item.addActionListener(createMoveAction(
ChangeAction.AUTHOR, value));
changeTo.add(item);
*/
private JMenuItem createMenuItemRename(
@SuppressWarnings("unused") boolean libOk) {
- JMenuItem changeTo = new JMenuItem("Rename...");
+ JMenuItem changeTo = new JMenuItem(GuiReader.trans(StringIdGui.MENU_FILE_RENAME));
changeTo.setMnemonic(KeyEvent.VK_R);
changeTo.addActionListener(createMoveAction(ChangeAction.TITLE, null));
return changeTo;
}
Object rep = JOptionPane.showInputDialog(
- GuiReaderFrame.this, "Move to:",
- "Moving story", JOptionPane.QUESTION_MESSAGE,
+ GuiReaderFrame.this, GuiReader.trans(StringIdGui.SUBTITLE_MOVE_TO),
+ GuiReader.trans(StringIdGui.TITLE_MOVE_TO), JOptionPane.QUESTION_MESSAGE,
null, null, init);
if (rep == null) {
* @return the item
*/
private JMenuItem createMenuItemRedownload() {
- JMenuItem refresh = new JMenuItem("Redownload", KeyEvent.VK_R);
+ JMenuItem refresh = new JMenuItem(GuiReader.trans(StringIdGui.MENU_EDIT_REDOWNLOAD), KeyEvent.VK_R);
refresh.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
meta.getSource());
}
}
- }, "Removing old copy");
+ }, GuiReader.trans(StringIdGui.PROGRESS_REDOWNLOAD_REMOVE_OLD_COPY));
}
}
});
* @return the item
*/
private JMenuItem createMenuItemDelete() {
- JMenuItem delete = new JMenuItem("Delete", KeyEvent.VK_D);
+ JMenuItem delete = new JMenuItem(GuiReader.trans(StringIdGui.MENU_EDIT_DELETE), KeyEvent.VK_D);
delete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final MetaData meta = selectedBook.getInfo().getMeta();
int rep = JOptionPane.showConfirmDialog(
GuiReaderFrame.this,
- String.format("Delete %s: %s", meta.getLuid(),
- meta.getTitle()), "Delete story",
+ GuiReader.trans(StringIdGui.SUBTITLE_DELETE, meta.getLuid(),
+ meta.getTitle()), GuiReader.trans(StringIdGui.TITLE_DELETE),
JOptionPane.OK_CANCEL_OPTION);
if (rep == JOptionPane.OK_OPTION) {
* @return the item
*/
private JMenuItem createMenuItemProperties() {
- JMenuItem delete = new JMenuItem("Properties", KeyEvent.VK_P);
+ JMenuItem delete = new JMenuItem(GuiReader.trans(StringIdGui.MENU_FILE_PROPERTIES), KeyEvent.VK_P);
delete.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
* @return the item
*/
public JMenuItem createMenuItemOpenBook() {
- JMenuItem open = new JMenuItem("Open", KeyEvent.VK_O);
+ JMenuItem open = new JMenuItem(GuiReader.trans(StringIdGui.MENU_FILE_OPEN), KeyEvent.VK_O);
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
* @return the item
*/
private JMenuItem createMenuItemSetCoverForSource() {
- JMenuItem open = new JMenuItem("Set as cover for source", KeyEvent.VK_C);
+ JMenuItem open = new JMenuItem(GuiReader.trans(StringIdGui.MENU_EDIT_SET_COVER_FOR_SOURCE), KeyEvent.VK_C);
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
* @return the item
*/
private JMenuItem createMenuItemSetCoverForAuthor() {
- JMenuItem open = new JMenuItem("Set as cover for author", KeyEvent.VK_A);
+ JMenuItem open = new JMenuItem(GuiReader.trans(StringIdGui.MENU_EDIT_SET_COVER_FOR_AUTHOR), KeyEvent.VK_A);
open.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
public GuiReader getReader() {
return reader;
}
+
+ /**
+ * Return the title of the application.
+ *
+ * @param libraryName
+ * the name of the associated {@link BasicLibrary}, which can be
+ * EMPTY
+ *
+ * @return the title
+ */
+ static private String getAppTitle(String libraryName) {
+ if (!libraryName.isEmpty()) {
+ return GuiReader.trans(StringIdGui.TITLE_LIBRARY_WITH_NAME, Version
+ .getCurrentVersion().toString(), libraryName);
+ }
+
+ return GuiReader.trans(StringIdGui.TITLE_LIBRARY, Version.getCurrentVersion()
+ .toString());
+ }
}
import javax.swing.JLabel;
import javax.swing.JPanel;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.reader.ui.GuiReaderBook.BookActionListener;
import be.nikiroo.utils.ui.WrapLayout;
if (title != null) {
if (title.isEmpty()) {
- title = "[unknown]";
+ title = GuiReader.trans(StringIdGui.MENU_AUTHORS_UNKNOWN);
}
JLabel label = new JLabel();
import javax.swing.SwingUtilities;
import be.nikiroo.fanfix.Instance;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.bundles.UiConfig;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
helper.createMenu(false);
validate();
- String err = lib.getLibraryName() + "\n";
- switch (status) {
- case INVALID:
- err += "Library not valid";
- break;
-
- case UNAUTORIZED:
- err += "You are not allowed to access this library";
- break;
-
- case UNAVAILABLE:
- err += "Library currently unavailable";
- break;
-
- default:
- err += "An error occured when contacting the library";
- break;
+ String desc = Instance.getTransGui().getStringX(
+ StringIdGui.ERROR_LIB_STATUS,
+ status.toString());
+ if (desc == null) {
+ desc = GuiReader
+ .trans(StringIdGui.ERROR_LIB_STATUS);
}
- error(err, "Library error", null);
+ String err = lib.getLibraryName() + "\n" + desc;
+ error(err, GuiReader
+ .trans(StringIdGui.TITLE_ERROR_LIBRARY),
+ null);
}
}
});
BasicLibrary lib = helper.getReader().getLibrary();
if (type) {
if (!listMode) {
- addListPane("Sources", lib.getSources(), type);
+ addListPane(GuiReader.trans(StringIdGui.MENU_SOURCES),
+ lib.getSources(), type);
} else {
for (String tt : lib.getSources()) {
if (tt != null) {
}
} else {
if (!listMode) {
- addListPane("Authors", lib.getAuthors(), type);
+ addListPane(GuiReader.trans(StringIdGui.MENU_AUTHORS),
+ lib.getAuthors(), type);
} else {
for (String tt : lib.getAuthors()) {
if (tt != null) {
});
} catch (IOException e) {
Instance.getTraceHandler().error(e);
- error("Cannot open the selected book", "Error", e);
+ error(GuiReader.trans(StringIdGui.ERROR_CANNOT_OPEN),
+ GuiReader.trans(StringIdGui.TITLE_ERROR), e);
}
}
});
public void outOfUi(Progress progress, final boolean refreshBooks,
final Runnable run) {
final Progress pg = new Progress();
- final Progress reload = new Progress("Reload books");
+ final Progress reload = new Progress(
+ GuiReader.trans(StringIdGui.PROGRESS_OUT_OF_UI_RELOAD_BOOKS));
if (progress == null) {
progress = new Progress();
}
url = JOptionPane.showInputDialog(GuiReaderMainPanel.this,
- "url of the story to import?", "Importing from URL",
+ GuiReader.trans(StringIdGui.SUBTITLE_IMPORT_URL),
+ GuiReader.trans(StringIdGui.TITLE_IMPORT_URL),
JOptionPane.QUESTION_MESSAGE, null, null, clipboard);
} else if (fc.showOpenDialog(this) != JFileChooser.CANCEL_OPTION) {
url = fc.getSelectedFile().getAbsolutePath();
pgOnSuccess.setProgress(0);
if (!ok) {
if (e instanceof UnknownHostException) {
- error("URL not supported: " + url, "Cannot import URL",
- null);
+ error(GuiReader.trans(
+ StringIdGui.ERROR_URL_NOT_SUPPORTED, url),
+ GuiReader.trans(StringIdGui.TITLE_ERROR), null);
} else {
- error("Failed to import " + url + ": \n"
- + e.getMessage(), "Cannot import URL", e);
+ error(GuiReader.trans(
+ StringIdGui.ERROR_URL_IMPORT_FAILED, url,
+ e.getMessage()), GuiReader
+ .trans(StringIdGui.TITLE_ERROR), e);
}
} else {
if (onSuccess != null) {
import javax.swing.JFrame;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.library.BasicLibrary;
* the meta to describe
*/
public GuiReaderPropertiesFrame(BasicLibrary lib, MetaData meta) {
- setTitle(meta.getLuid() + ": " + meta.getTitle());
+ setTitle(GuiReader.trans(StringIdGui.TITLE_STORY, meta.getLuid(),
+ meta.getTitle()));
GuiReaderPropertiesPane desc = new GuiReaderPropertiesPane(lib, meta);
setSize(800,
import javax.swing.JPanel;
import javax.swing.SwingConstants;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Story;
* the {@link Story} to display
*/
public GuiReaderViewer(BasicLibrary lib, Story story) {
- super(story.getMeta().getLuid() + ": " + story.getMeta().getTitle());
+ setTitle(GuiReader.trans(StringIdGui.TITLE_STORY, story.getMeta()
+ .getLuid(), story.getMeta().getTitle()));
setSize(800, 600);
descPane.setVisible(false);
}
- chapterLabel.setText("<HTML> <B>Chapter "
- + chap.getNumber() + "</B>: " + chap.getName() + "</HTML>");
+ String chapterDisplay = GuiReader.trans(
+ StringIdGui.CHAPTER_HTML_UNNAMED, chap.getNumber(), story
+ .getChapters().size());
+ if (chap.getName() != null && !chap.getName().trim().isEmpty()) {
+ chapterDisplay = GuiReader.trans(
+ StringIdGui.CHAPTER_HTML_NAMED, chap.getNumber(), story
+ .getChapters().size(), chap.getName());
+ }
+
+ chapterLabel.setText("<HTML>" + chapterDisplay + "</HTML>");
mainPanel.setChapter(chap);
}
import javax.swing.SwingConstants;
import be.nikiroo.fanfix.Instance;
+import be.nikiroo.fanfix.bundles.StringIdGui;
import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.utils.Image;
}
imageProgress.setValue(i);
- imageProgress.setString(String.format("Image %d / %d", i + 1, chap
- .getParagraphs().size()));
+ imageProgress.setString(GuiReader.trans(StringIdGui.IMAGE_PROGRESSION,
+ i + 1, chap.getParagraphs().size()));
currentImage = i;