- it can be used to edit your data (currently in RAW format, field by field)
- it can save back to file
- English and French versions available (will look for the host language, can be forced with "--lang en")
-- remote synchronisation server (still in testing)
+- remote synchronisation server (still in testing, but should work)
## TODO
-- customisation of VIEW_CONTACT
- lot of other things
- correct UI for new contact/new data/edit data-types
+- update the screenshots
## Screenshots
*/
public class Main {
static public final String APPLICATION_TITLE = "jVcard";
- static public final String APPLICATION_VERSION = "1.0-beta3-dev";
+ static public final String APPLICATION_VERSION = "1.0";
static private final int ERR_NO_FILE = 1;
static private final int ERR_SYNTAX = 2;
static private boolean forceComputedFn;
enum Mode {
- CONTACT_MANAGER, I18N, SERVER, LOAD_PHOTO, SAVE_PHOTO, ONLY_PHOTO, SAVE_CONFIG
+ CONTACT_MANAGER, I18N, SERVER, LOAD_PHOTO, SAVE_PHOTO, SAVE_CONFIG, HELP
}
/**
if (!noMoreParams && arg.equals("--")) {
noMoreParams = true;
} else if (!noMoreParams && arg.equals("--help")) {
- System.out
- .println("TODO: implement some help text.\n"
- + "Usable switches:\n"
- + "\t--: stop looking for switches\n"
- + "\t--help: this here thingy\n"
- + "\t--lang LANGUAGE: choose the language, for instance en_GB\n"
- + "\t--tui: force pure text mode even if swing treminal is available\n"
- + "\t--gui: force swing terminal mode\n"
- + "\t--noutf: force non-utf8 mode if you need it\n"
- + "\t--config DIRECTORY: use the given directory as a CONFIG_DIR\n"
- + "\t--save-config DIRECTORY: save the current config to DIRECTORY (lang: only current)\n"
- + "\t--server PORT: start a remoting server instead of a client\n"
- + "\t--i18n DIR: generate the translation file for the given language (can be \"\") to/from the .properties given dir\n"
- + "\t--save-photo DIR FORMAT: save the contacts' photos to DIR, named after FORMAT\n"
- + "\t--load-photo DIR FORMAT: load the contacts' photos from DIR, named after FORMAT\n"
- + "\t--only-photo DIR FORMAT: load the contacts' photos from DIR, named after FORMAT, overwrite all other photos of selected contacts\n"
- + "everyhing else is either a file to open or a directory to open\n"
- + "(we will only open 1st level files in given directories)\n"
- + "('jvcard://hostname:8888/file' links -- or without 'file' -- are also ok)\n");
- return;
+ if (mode != Mode.CONTACT_MANAGER) {
+ SERR(StringId.CLI_SERR_MODES);
+ return;
+ }
+ mode = Mode.HELP;
} else if (!noMoreParams && arg.equals("--tui")) {
textMode = true;
} else if (!noMoreParams && arg.equals("--gui")) {
} else if (!noMoreParams && arg.equals("--lang")) {
index++;
if (index >= args.length) {
- System.err.println("Syntax error: no language given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NOLANG);
return;
}
} else if (!noMoreParams && arg.equals("--config")) {
index++;
if (index >= args.length) {
- System.err
- .println("Syntax error: no config directory given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NODIR);
return;
}
} else if (!noMoreParams && arg.equals("--save-config")) {
index++;
if (index >= args.length) {
- System.err
- .println("Syntax error: no config directory given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NODIR);
return;
}
dir = args[index];
if (mode != Mode.CONTACT_MANAGER) {
- System.err
- .println("Syntax error: you can only use one of: \n"
- + "--server\n"
- + "--save-config\n"
- + "--i18n\n"
- + "--load-photo\n"
- + "--save-photo\n" + "--only-photo\n");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_MODES);
return;
}
mode = Mode.SAVE_CONFIG;
} else if (!noMoreParams && arg.equals("--server")) {
if (mode != Mode.CONTACT_MANAGER) {
- System.err
- .println("Syntax error: you can only use one of: \n"
- + "--server\n"
- + "--save-config\n"
- + "--i18n\n"
- + "--load-photo\n"
- + "--save-photo\n" + "--only-photo\n");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_MODES);
return;
}
mode = Mode.SERVER;
index++;
if (index >= args.length) {
- System.err.println("Syntax error: no port given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NOPORT);
return;
}
try {
port = Integer.parseInt(args[index]);
} catch (NumberFormatException e) {
- System.err.println("Invalid port number: " + args[index]);
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_BADPORT, "" + args[index]);
return;
}
} else if (!noMoreParams && arg.equals("--i18n")) {
if (mode != Mode.CONTACT_MANAGER) {
- System.err
- .println("Syntax error: you can only use one of: \n"
- + "--server\n"
- + "--save-config\n"
- + "--i18n\n"
- + "--load-photo\n"
- + "--save-photo\n" + "--only-photo\n");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_MODES);
return;
}
mode = Mode.I18N;
index++;
if (index >= args.length) {
- System.err
- .println("Syntax error: no .properties directory given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NODIR);
return;
}
|| arg.equals("--save-photo") || arg
.equals("--only-photo"))) {
if (mode != Mode.CONTACT_MANAGER) {
- System.err
- .println("Syntax error: you can only use one of: \n"
- + "--server\n"
- + "--save-config\n"
- + "--i18n\n"
- + "--load-photo\n"
- + "--save-photo\n" + "--only-photo\n");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_MODES);
return;
}
mode = Mode.LOAD_PHOTO;
} else if (arg.equals("--save-photo")) {
mode = Mode.SAVE_PHOTO;
- } else {
- mode = Mode.ONLY_PHOTO;
}
index++;
if (index >= args.length) {
- System.err.println("Syntax error: photo directory given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NODIR);
return;
}
index++;
if (index >= args.length) {
- System.err.println("Syntax error: photo format given");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NOFORMAT);
return;
}
// Error management:
if (mode == Mode.SERVER && files.size() > 0) {
- System.err
- .println("Invalid syntax: you cannot both use --server and provide card files");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NOLANG, "--server");
+ return;
} else if (mode == Mode.I18N && files.size() > 0) {
- System.err
- .println("Invalid syntax: you cannot both use --i18n and provide card files");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NOLANG, "--i18n");
+ return;
} else if (mode == Mode.I18N && language == null) {
- System.err
- .println("Invalid syntax: you cannot use --i18n without --lang");
- System.exit(ERR_SYNTAX);
+ SERR(StringId.CLI_SERR_NOLANG);
} else if ((mode == Mode.CONTACT_MANAGER || mode == Mode.SAVE_PHOTO || mode == Mode.LOAD_PHOTO)
&& files.size() == 0) {
if (files.size() == 0 && !filesTried) {
}
if (files.size() == 0) {
- System.err.println("No files to open");
- System.exit(ERR_NO_FILE);
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR_NOFILES, ERR_NO_FILE);
return;
}
}
try {
if (!new File(dir).isDirectory()) {
if (!new File(dir).mkdir()) {
- System.err
- .println("Cannot create configuration directory: "
- + dir);
+ System.err.println(trans(
+ StringId.CLI_ERR_CANNOT_CREATE_CONFDIR, dir));
}
}
System.err
.println("I/O Exception: Cannot start the server");
} else {
- System.err.println("Remoting support not available");
- System.exit(ERR_INTERNAL);
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR_NO_REMOTING,
+ ERR_INTERNAL);
+ return;
}
}
break;
try {
transService.updateFile(dir);
} catch (IOException e) {
- System.err
- .println("I/O Exception: Cannot create/update a language in directory: "
- + dir);
+ System.err.println(trans(StringId.CLI_ERR_CANNOT_CREATE_LANG,
+ dir));
e.printStackTrace();
}
break;
}
- case ONLY_PHOTO:
case LOAD_PHOTO: {
for (String file : files) {
try {
String b64 = StringUtils.fromImage(ImageIO
.read(f));
- if (mode == Mode.ONLY_PHOTO) {
- for (Data photo = contact
- .getPreferredData("PHOTO"); photo != null; photo = contact
- .getPreferredData("PHOTO")) {
- photo.delete();
- }
+ // remove previous photos:
+ for (Data photo = contact
+ .getPreferredData("PHOTO"); photo != null; photo = contact
+ .getPreferredData("PHOTO")) {
+ photo.delete();
}
+ //
List<TypeInfo> types = new LinkedList<TypeInfo>();
types.add(new TypeInfo("ENCODING", "b"));
}
card.save();
} catch (IOException e) {
- System.err.println("Card cannot be opened: " + file);
+ System.err
+ .println(trans(StringId.CLI_ERR_CANNOT_OPEN, file));
}
}
break;
StringUtils.toImage(photo.getValue()),
"png", f);
} catch (IOException e) {
- System.err
- .println("Cannot save photo of contact: "
- + contact
- .getPreferredDataValue("FN"));
+ System.err.println(trans(
+ StringId.CLI_ERR_CANNOT_SAVE_PHOTO,
+ contact.getPreferredDataValue("FN")));
}
}
}
} catch (IOException e) {
- System.err.println("Card cannot be opened: " + file);
+ System.err
+ .println(trans(StringId.CLI_ERR_CANNOT_OPEN, file));
}
}
break;
Optional.startTui(textMode, files);
} catch (Exception e) {
if (e instanceof IOException) {
- System.err
- .println("I/O Exception: Cannot start the program with the given cards");
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR_CANNOT_START,
+ ERR_NO_FILE);
+ return;
} else {
- System.err.println("TUI support not available");
- System.exit(ERR_INTERNAL);
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR_NO_TUI, ERR_INTERNAL);
+ return;
}
}
break;
}
+ case HELP: {
+ System.out.println(APPLICATION_TITLE + " " + APPLICATION_VERSION);
+ System.out.println();
+
+ System.out.println(trans(StringId.CLI_HELP));
+ System.out.println();
+
+ System.out.println(trans(StringId.CLI_HELP_MODES));
+ System.out.println("\t--help : "
+ + trans(StringId.CLI_HELP_MODE_HELP));
+ System.out.println("\t(--tui|--gui) (--noutf) ... : "
+ + trans(StringId.CLI_HELP_MODE_CONTACT_MANAGER));
+ System.out.println("\t--server PORT ... : "
+ + trans(StringId.CLI_HELP_MODE_SERVER));
+ System.out.println("\t--save-config DIR : "
+ + trans(StringId.CLI_HELP_MODE_SAVE_CONFIG));
+ System.out.println("\t--i18n DIR ---lang LANG : "
+ + trans(StringId.CLI_HELP_MODE_I18N));
+ System.out.println("\t--load-photo DIR FORMAT ... : "
+ + trans(StringId.CLI_HELP_MODE_LOAD_PHOTO));
+ System.out.println("\t--save-photo DIR FORMAT ... : "
+ + trans(StringId.CLI_HELP_MODE_SAVE_PHOTO));
+ System.out.println();
+
+ System.out.println(trans(StringId.CLI_HELP_OPTIONS));
+ System.out.println("\t-- : " + trans(StringId.CLI_HELP_DD));
+ System.out.println("\t--lang LANG : "
+ + trans(StringId.CLI_HELP_LANG));
+ System.out.println("\t--tui : " + trans(StringId.CLI_HELP_TUI));
+ System.out.println("\t--gui : " + trans(StringId.CLI_HELP_GUI));
+ System.out.println("\t--noutf : " + trans(StringId.CLI_HELP_NOUTF));
+ System.out.println("\t--config : "
+ + trans(StringId.CLI_HELP_CONFIG));
+ System.out.println();
+
+ System.out.println(trans(StringId.CLI_HELP_FOOTER));
+ System.out.println();
+
+ }
}
}
forceComputedFn = map.getBoolean(
DisplayOption.CONTACT_DETAILS_SHOW_COMPUTED_FN, false);
}
+
+ /**
+ * Syntax error detected, closing the application with an error message.
+ *
+ * @param err
+ * the syntax error case
+ */
+ static private void SERR(StringId err, Object... values) {
+ ERR(StringId.CLI_SERR, err, ERR_SYNTAX, values);
+ }
+
+ /**
+ * Error detected, closing the application with an error message.
+ *
+ * @param err
+ * the error case
+ * @param suberr
+ * the suberror or NULL if none
+ * @param CODE
+ * the error code as declared above
+ */
+ static private void ERR(StringId err, StringId suberr, int CODE,
+ Object... subvalues) {
+ if (suberr == null)
+ System.err.println(trans(err));
+ else
+ System.err.println(trans(err, trans(suberr, subvalues)));
+
+ System.exit(CODE);
+ }
}
protected void writeValue(Writer writer, E id) throws IOException {
writer.write(id.name());
writer.write(" = ");
- writer.write(getString(id));
- writer.write("\n");
+
+ String[] lines = getString(id).replaceAll("\\\t", "\\\\\\t").split(
+ "\n");
+ for (int i = 0; i < lines.length; i++) {
+ writer.write(lines[i]);
+ if (i < lines.length - 1) {
+ writer.write("\\n\\");
+ }
+ writer.write("\n");
+ }
}
/**
setLanguage(language);
}
- @Override
- public String getString(StringId id) {
- return getString(id, (Object[]) null);
- }
-
/**
* Translate the given {@link StringId} into user text.
*
this.utf = utf;
}
+ /**
+ * Initialise the translation mappings for the given language.
+ *
+ * @param language
+ * the language to initialise, in the form "en-GB" or "fr" for
+ * instance
+ */
+ private void setLanguage(String language) {
+ locale = getLocaleFor(language);
+ map = getBundle(Target.resources, locale);
+ }
+
+ @Override
+ public String getString(StringId id) {
+ return getString(id, (Object[]) null);
+ }
+
@Override
protected File getUpdateFile(String path) {
String code = locale.toString();
StringId.writeHeader(writer, name);
}
- /**
- * Initialise the translation mappings for the given language.
- *
- * @param language
- * the language to initialise, in the form "en-GB" or "fr" for
- * instance
- */
- private void setLanguage(String language) {
- locale = getLocaleFor(language);
- map = getBundle(Target.resources, locale);
- }
-
/**
* Return the {@link Locale} representing the given language.
*
return locale;
}
+
}
KEY_ACTION_EDIT_CONTACT, //
@Meta(what = "Action key", where = "ContactDetails", format = "", info = "Edit the contact in RAW mode")
KEY_ACTION_EDIT_CONTACT_RAW, //
+ @Meta(what = "Action key", where = "ContactDetailsRaw", format = "", info = "Edit the RAW field")
+ KEY_ACTION_EDIT_FIELD, //
@Meta(what = "Action key", where = "ContactList", format = "", info = "Save the whole card")
KEY_ACTION_SAVE_CARD, //
- @Meta(what = "", where = "ContactList", format = "", info = "Delete the selected contact")
- KEY_ACTION_DELETE_CONTACT, //
+ @Meta(what = "", where = "ContactList/ContactDetailsRaw", format = "", info = "Delete the selected element")
+ KEY_ACTION_DELETE, //
@Meta(what = "Action key", where = "ContactList", format = "", info = "Filter the displayed contacts")
KEY_ACTION_SEARCH, //
@Meta(what = "", where = "", format = "we could use: ' ', ┃, │...", info = "Field separator")
CONFIRM_USER_DELETE_CONTACT, //
@Meta(what = "Error", where = "Contact list", format = "%s = contact name", info = "cannot delete a contact")
ERR_CANNOT_DELETE_CONTACT, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message header line")
+ CLI_HELP, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line before explaining the different modes")
+ CLI_HELP_MODES, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for help usage")
+ CLI_HELP_MODE_HELP, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for contact manager usage")
+ CLI_HELP_MODE_CONTACT_MANAGER, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for contact manager usage")
+ CLI_HELP_MODE_I18N, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for jVCard server usage")
+ CLI_HELP_MODE_SERVER, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for --load-photo usage")
+ CLI_HELP_MODE_LOAD_PHOTO, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for --save-photo usage")
+ CLI_HELP_MODE_SAVE_PHOTO, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for config save usage")
+ CLI_HELP_MODE_SAVE_CONFIG, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line before the list of options")
+ CLI_HELP_OPTIONS, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --")
+ CLI_HELP_DD, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --")
+ CLI_HELP_LANG, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --")
+ CLI_HELP_GUI, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --")
+ CLI_HELP_TUI, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --")
+ CLI_HELP_NOUTF, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message line for: --")
+ CLI_HELP_CONFIG, //
+ @Meta(what = "CLI --help", where = "", format = "", info = "The Help message footer about files and jvcard:// links")
+ CLI_HELP_FOOTER, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = the error", info = "Syntax error: SOME TEXT")
+ CLI_SERR, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "More than one mode given")
+ CLI_SERR_MODES, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "--lang is required")
+ CLI_SERR_NOLANG, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "The dir is required")
+ CLI_SERR_NODIR, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "The port is required")
+ CLI_SERR_NOPORT, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "The format is required")
+ CLI_SERR_NOFORMAT, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = bad port", info = "The port is not valid")
+ CLI_SERR_BADPORT, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = mode", info = "Card files are not supported in mode %s")
+ CLI_SERR_CANNOT_CARDS, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = the error", info = "Error: SOME TEXT")
+ CLI_ERR, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "No files given")
+ CLI_ERR_NOFILES, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = dir", info = "Cannot create conf dir %s")
+ CLI_ERR_CANNOT_CREATE_CONFDIR, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "Remoting not available")
+ CLI_ERR_NO_REMOTING, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "TUI not available")
+ CLI_ERR_NO_TUI, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = dir", info = "Cannot create/update language in dir %s")
+ CLI_ERR_CANNOT_CREATE_LANG, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = card", info = "Cannot open card %s")
+ CLI_ERR_CANNOT_OPEN, //
+ @Meta(what = "CLI ERROR", where = "", format = "%s = contact FN", info = "Cannot save photo of contact %s")
+ CLI_ERR_CANNOT_SAVE_PHOTO, //
+ @Meta(what = "CLI ERROR", where = "", format = "", info = "Cannot start the program with the given cards")
+ CLI_ERR_CANNOT_START, //
;
writer.write("# \n");
writer.write("# Also, the comments always refer to the key below them.\n");
writer.write("# \n");
- writer.write("\n");
}
};
# Also, the comments always refer to the key below them.
#
+
# (WHAT: a key to press, WHERE: action keys, FORMAT: MUST BE 3 chars long)
# Tab key
KEY_TAB = TAB
# (WHAT: a key to press, WHERE: action keys, FORMAT: MUST BE 3 chars long)
# Enter key
KEY_ENTER = ENT
+# (WHAT: Action key, WHERE: All screens except the first (KEY_ACTION_QUIT))
+# Go back to previous screen
KEY_ACTION_BACK = Back
+# (WHAT: Action key, WHERE: MainWindow)
+# Get help text
KEY_ACTION_HELP = Help
+# (WHAT: Action key, WHERE: FileList)
+# View the selected card
KEY_ACTION_VIEW_CARD = Open
+# (WHAT: Action key, WHERE: ContactList)
+# View the selected contact
KEY_ACTION_VIEW_CONTACT = Open
+# (WHAT: Action key, WHERE: ContactDetails)
+# Edit the contact
KEY_ACTION_EDIT_CONTACT = Edit
+# (WHAT: Action key, WHERE: ContactDetails)
+# Edit the contact in RAW mode
+KEY_ACTION_EDIT_CONTACT_RAW = Raw
+# (WHAT: Action key, WHERE: ContactDetailsRaw)
+# Edit the RAW field
+KEY_ACTION_EDIT_FIELD = Edit
+# (WHAT: Action key, WHERE: ContactList)
+# Save the whole card
KEY_ACTION_SAVE_CARD = Save
-KEY_ACTION_DELETE_CONTACT = Delete
+# (WHERE: ContactList/ContactDetailsRaw)
+# Delete the selected element
+KEY_ACTION_DELETE = Delete
+# (WHAT: Action key, WHERE: ContactList)
+# Filter the displayed contacts
KEY_ACTION_SEARCH = Search
-# we could use: ' ', ┃, │...
+# (FORMAT: we could use: ' ', ┃, │...)
+# Field separator
DEAULT_FIELD_SEPARATOR = ┃
-DEAULT_FIELD_SEPARATOR_NOUTF = |
+# (WHAT: Action key, WHERE: ContactDetails)
+# Invert the photo's colours
KEY_ACTION_INVERT = Invert colours
+# (WHAT: Action key, WHERE: ContactDetails)
+# Show the photo in 'fullscreen'
KEY_ACTION_FULLSCREEN = Fullscreen
+# (WHAT: Action key, WHERE: ContactList, ContactDetails, ContactDetailsRaw)
+# Switch between the available display formats
KEY_ACTION_SWITCH_FORMAT = Change view
# (WHAT: Action key, WHERE: Contact list, Edit Contact)
# Add a new contact/field
# (WHAT: Error, WHERE: Contact list, FORMAT: %s = contact name)
# cannot delete a contact
ERR_CANNOT_DELETE_CONTACT = Cannot delete "%s"
+# (WHAT: CLI --help)
+# The Help message header line
+CLI_HELP = jVCard is a small contact manager written in Java\n\
+It supports the VCF and aBook formats, though it uses VCF internally\n\
+You can get the latest version at https://github.com/nikiroo/jvcard
+# (WHAT: CLI --help)
+# The Help message line before explaining the different modes
+CLI_HELP_MODES = You can use jVCard in different modes:
+# (WHAT: CLI --help)
+# The Help message line for help usage
+CLI_HELP_MODE_HELP = print this help message
+# (WHAT: CLI --help)
+# The Help message line for contact manager usage
+CLI_HELP_MODE_CONTACT_MANAGER = launch the contact manager
+# (WHAT: CLI --help)
+# The Help message line for contact manager usage
+CLI_HELP_MODE_I18N = generate the i18n resource file for LANG in the directory DIR
+# (WHAT: CLI --help)
+# The Help message line for jVCard server usage
+CLI_HELP_MODE_SERVER = launch a jVCard remote server on port PORT
+# (WHAT: CLI --help)
+# The Help message line for --load-photo usage
+CLI_HELP_MODE_LOAD_PHOTO = load the contact photos (following FORMAT) from DIR
+# (WHAT: CLI --help)
+# The Help message line for --save-photo usage
+CLI_HELP_MODE_SAVE_PHOTO = save the contact photos (following FORMAT) into DIR
+# (WHAT: CLI --help)
+# The Help message line for config save usage
+CLI_HELP_MODE_SAVE_CONFIG = save the configuration files into DIR
+# (WHAT: CLI --help)
+# The Help message line before the list of options
+CLI_HELP_OPTIONS = The following options are supported:
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_DD = stop looking for options
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_LANG = manually set the language to LANG
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_GUI = force the SWING terminal emulator
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_TUI = force text mode (and supports headless JRE)
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_NOUTF = do not use UTF-8, prefer simple ASCII
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_CONFIG = set the configuration directory to DIR
+# (WHAT: CLI --help)
+# The Help message footer about files and jvcard:// links
+CLI_HELP_FOOTER = All other parameters are taken as cards:\n\
+\t- files will be opened as VCF if they end in .vcf\n\
+\t- files will be opened as aBook if they don't end in .vcf\n\
+\t- directory will be scanned for files (not recursive)\n\
+\t- remote jvcard cards "jvcard://server:port/name" are supported\n\
+\t- remote jvcard cards lists "jvcard://server:port/" are supported
+# (WHAT: CLI ERROR, FORMAT: %s = the error)
+# Syntax error: SOME TEXT
+CLI_SERR = Syntax error: %s
+# (WHAT: CLI ERROR)
+# More than one mode given
+CLI_SERR_MODES = you can only use one of: \n\
+\t--server\n\
+\t--save-config\n\
+\t--i18n\n\
+\t--load-photo\n\
+\t--save-photo
+# (WHAT: CLI ERROR)
+# --lang is required
+CLI_SERR_NOLANG = language is required
+# (WHAT: CLI ERROR)
+# The dir is required
+CLI_SERR_NODIR = directory is required
+# (WHAT: CLI ERROR)
+# The port is required
+CLI_SERR_NOPORT = port is required
+# (WHAT: CLI ERROR)
+# The format is required
+CLI_SERR_NOFORMAT = format is required
+# (WHAT: CLI ERROR, FORMAT: %s = bad port)
+# The port is not valid
+CLI_SERR_BADPORT = not a valid port: %
+# (WHAT: CLI ERROR, FORMAT: %s = mode)
+# Card files are not supported in mode %s
+CLI_SERR_CANNOT_CARDS = cards are not supported in mode %s
+# (WHAT: CLI ERROR, FORMAT: %s = the error)
+# Error: SOME TEXT
+CLI_ERR = Error:
+# (WHAT: CLI ERROR)
+# No files given
+CLI_ERR_NOFILES = no cards to open
+# (WHAT: CLI ERROR, FORMAT: %s = dir)
+# Cannot create conf dir %s
+CLI_ERR_CANNOT_CREATE_CONFDIR = cannot create configuration directory: %s
+# (WHAT: CLI ERROR)
+# Remoting not available
+CLI_ERR_NO_REMOTING = remoting support not available
+# (WHAT: CLI ERROR)
+# TUI not available
+CLI_ERR_NO_TUI = TUI support not available
+# (WHAT: CLI ERROR, FORMAT: %s = dir)
+# Cannot create/update language in dir %s
+CLI_ERR_CANNOT_CREATE_LANG = cannot create/update the language file in: %s
+# (WHAT: CLI ERROR, FORMAT: %s = card)
+# Cannot open card %s
+CLI_ERR_CANNOT_OPEN = cannot open card: %s
+# (WHAT: CLI ERROR, FORMAT: %s = contact FN)
+# Cannot save photo of contact %s
+CLI_ERR_CANNOT_SAVE_PHOTO = cannot save photo of contact: %s
+# (WHAT: CLI ERROR)
+# Cannot start the program with the given cards
+CLI_ERR_CANNOT_START = cannot start the program with the given cards
# Also, the comments always refer to the key below them.
#
+
# (WHAT: a key to press, WHERE: action keys, FORMAT: MUST BE 3 chars long)
# Tab key
KEY_TAB = TAB
# (WHAT: a key to press, WHERE: action keys, FORMAT: MUST BE 3 chars long)
# Enter key
KEY_ENTER = ENT
+# (WHAT: Action key, WHERE: All screens except the first (KEY_ACTION_QUIT))
+# Go back to previous screen
KEY_ACTION_BACK = Back
+# (WHAT: Action key, WHERE: MainWindow)
+# Get help text
KEY_ACTION_HELP = Help
+# (WHAT: Action key, WHERE: FileList)
+# View the selected card
KEY_ACTION_VIEW_CARD = Open
+# (WHAT: Action key, WHERE: ContactList)
+# View the selected contact
KEY_ACTION_VIEW_CONTACT = Open
+# (WHAT: Action key, WHERE: ContactDetails)
+# Edit the contact
KEY_ACTION_EDIT_CONTACT = Edit
+# (WHAT: Action key, WHERE: ContactDetails)
+# Edit the contact in RAW mode
+KEY_ACTION_EDIT_CONTACT_RAW =
+# (WHAT: Action key, WHERE: ContactDetailsRaw)
+# Edit the RAW field
+KEY_ACTION_EDIT_FIELD = Edit
+# (WHAT: Action key, WHERE: ContactList)
+# Save the whole card
KEY_ACTION_SAVE_CARD = Save
-KEY_ACTION_DELETE_CONTACT = Delete
+# (WHERE: ContactList/ContactDetailsRaw)
+# Delete the selected element
+KEY_ACTION_DELETE = Delete
+# (WHAT: Action key, WHERE: ContactList)
+# Filter the displayed contacts
KEY_ACTION_SEARCH = Search
-# we could use: ' ', ┃, │...
+# (FORMAT: we could use: ' ', ┃, │...)
+# Field separator
DEAULT_FIELD_SEPARATOR = ┃
-DEAULT_FIELD_SEPARATOR_NOUTF = |
+# (WHAT: Action key, WHERE: ContactDetails)
+# Invert the photo's colours
KEY_ACTION_INVERT = Invert colours
+# (WHAT: Action key, WHERE: ContactDetails)
+# Show the photo in 'fullscreen'
KEY_ACTION_FULLSCREEN = Fullscreen
+# (WHAT: Action key, WHERE: ContactList, ContactDetails, ContactDetailsRaw)
+# Switch between the available display formats
KEY_ACTION_SWITCH_FORMAT = Change view
# (WHAT: Action key, WHERE: Contact list, Edit Contact)
# Add a new contact/field
# (WHAT: Error, WHERE: Contact list, FORMAT: %s = contact name)
# cannot delete a contact
ERR_CANNOT_DELETE_CONTACT = Cannot delete "%s"
+# (WHAT: CLI --help)
+# The Help message header line
+CLI_HELP = jVCard is a small contact manager written in Java\n\
+It supports the VCF and aBook formats, though it uses VCF internally\n\
+You can get the latest version at https://github.com/nikiroo/jvcard
+# (WHAT: CLI --help)
+# The Help message line before explaining the different modes
+CLI_HELP_MODES = You can use jVCard in different modes:
+# (WHAT: CLI --help)
+# The Help message line for help usage
+CLI_HELP_MODE_HELP = print this help message
+# (WHAT: CLI --help)
+# The Help message line for contact manager usage
+CLI_HELP_MODE_CONTACT_MANAGER = launch the contact manager
+# (WHAT: CLI --help)
+# The Help message line for contact manager usage
+CLI_HELP_MODE_I18N = generate the i18n resource file for LANG in the directory DIR
+# (WHAT: CLI --help)
+# The Help message line for jVCard server usage
+CLI_HELP_MODE_SERVER = launch a jVCard remote server on port PORT
+# (WHAT: CLI --help)
+# The Help message line for --load-photo usage
+CLI_HELP_MODE_LOAD_PHOTO = load the contact photos (following FORMAT) from DIR
+# (WHAT: CLI --help)
+# The Help message line for --save-photo usage
+CLI_HELP_MODE_SAVE_PHOTO = save the contact photos (following FORMAT) into DIR
+# (WHAT: CLI --help)
+# The Help message line for config save usage
+CLI_HELP_MODE_SAVE_CONFIG = save the configuration files into DIR
+# (WHAT: CLI --help)
+# The Help message line before the list of options
+CLI_HELP_OPTIONS = The following options are supported:
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_DD = stop looking for options
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_LANG = manually set the language to LANG
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_GUI = force the SWING terminal emulator
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_TUI = force text mode (and supports headless JRE)
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_NOUTF = do not use UTF-8, prefer simple ASCII
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_CONFIG = set the configuration directory to DIR
+# (WHAT: CLI --help)
+# The Help message footer about files and jvcard:// links
+CLI_HELP_FOOTER = All other parameters are taken as cards:\n\
+\t- files will be opened as VCF if they end in .vcf\n\
+\t- files will be opened as aBook if they don't end in .vcf\n\
+\t- directory will be scanned for files (not recursive)\n\
+\t- remote jvcard cards "jvcard://server:port/name" are supported\n\
+\t- remote jvcard cards lists "jvcard://server:port/" are supported
+# (WHAT: CLI ERROR, FORMAT: %s = the error)
+# Syntax error: SOME TEXT
+CLI_SERR = Syntax error: %s
+# (WHAT: CLI ERROR)
+# More than one mode given
+CLI_SERR_MODES = you can only use one of: \n\
+\t--server\n\
+\t--save-config\n\
+\t--i18n\n\
+\t--load-photo\n\
+\t--save-photo
+# (WHAT: CLI ERROR)
+# --lang is required
+CLI_SERR_NOLANG = language is required
+# (WHAT: CLI ERROR)
+# The dir is required
+CLI_SERR_NODIR = directory is required
+# (WHAT: CLI ERROR)
+# The port is required
+CLI_SERR_NOPORT = port is required
+# (WHAT: CLI ERROR)
+# The format is required
+CLI_SERR_NOFORMAT = format is required
+# (WHAT: CLI ERROR, FORMAT: %s = bad port)
+# The port is not valid
+CLI_SERR_BADPORT = not a valid port: %
+# (WHAT: CLI ERROR, FORMAT: %s = mode)
+# Card files are not supported in mode %s
+CLI_SERR_CANNOT_CARDS = cards are not supported in mode %s
+# (WHAT: CLI ERROR, FORMAT: %s = the error)
+# Error: SOME TEXT
+CLI_ERR = Error:
+# (WHAT: CLI ERROR)
+# No files given
+CLI_ERR_NOFILES = no cards to open
+# (WHAT: CLI ERROR, FORMAT: %s = dir)
+# Cannot create conf dir %s
+CLI_ERR_CANNOT_CREATE_CONFDIR = cannot create configuration directory: %s
+# (WHAT: CLI ERROR)
+# Remoting not available
+CLI_ERR_NO_REMOTING = remoting support not available
+# (WHAT: CLI ERROR)
+# TUI not available
+CLI_ERR_NO_TUI = TUI support not available
+# (WHAT: CLI ERROR, FORMAT: %s = dir)
+# Cannot create/update language in dir %s
+CLI_ERR_CANNOT_CREATE_LANG = cannot create/update the language file in: %s
+# (WHAT: CLI ERROR, FORMAT: %s = card)
+# Cannot open card %s
+CLI_ERR_CANNOT_OPEN = cannot open card: %s
+# (WHAT: CLI ERROR, FORMAT: %s = contact FN)
+# Cannot save photo of contact %s
+CLI_ERR_CANNOT_SAVE_PHOTO = cannot save photo of contact: %s
+# (WHAT: CLI ERROR)
+# Cannot start the program with the given cards
+CLI_ERR_CANNOT_START = cannot start the program with the given cards
# Also, the comments always refer to the key below them.
#
+
# (WHAT: a key to press, WHERE: action keys, FORMAT: MUST BE 3 chars long)
# Tab key
KEY_TAB = TAB
# (WHAT: a key to press, WHERE: action keys, FORMAT: MUST BE 3 chars long)
# Enter key
KEY_ENTER = ENT
+# (WHAT: Action key, WHERE: All screens except the first (KEY_ACTION_QUIT))
+# Go back to previous screen
KEY_ACTION_BACK = Retour
+# (WHAT: Action key, WHERE: MainWindow)
+# Get help text
KEY_ACTION_HELP = Aide
+# (WHAT: Action key, WHERE: FileList)
+# View the selected card
KEY_ACTION_VIEW_CARD = Ouvrir
+# (WHAT: Action key, WHERE: ContactList)
+# View the selected contact
KEY_ACTION_VIEW_CONTACT = Afficher
+# (WHAT: Action key, WHERE: ContactDetails)
+# Edit the contact
KEY_ACTION_EDIT_CONTACT = Éditer
+# (WHAT: Action key, WHERE: ContactDetails)
+# Edit the contact in RAW mode
+KEY_ACTION_EDIT_CONTACT_RAW = Raw
+# (WHAT: Action key, WHERE: ContactDetailsRaw)
+# Edit the RAW field
+KEY_ACTION_EDIT_FIELD = Éditer
+# (WHAT: Action key, WHERE: ContactList)
+# Save the whole card
KEY_ACTION_SAVE_CARD = Sauver
-KEY_ACTION_DELETE_CONTACT = Supprimer
+# (WHERE: ContactList/ContactDetailsRaw)
+# Delete the selected element
+KEY_ACTION_DELETE = Supprimer
+# (WHAT: Action key, WHERE: ContactList)
+# Filter the displayed contacts
KEY_ACTION_SEARCH = Rechercher
-# we could use: ' ', ┃, │...
+# (FORMAT: we could use: ' ', ┃, │...)
+# Field separator
DEAULT_FIELD_SEPARATOR = ┃
-DEAULT_FIELD_SEPARATOR_NOUTF = |
+# (WHAT: Action key, WHERE: ContactDetails)
+# Invert the photo's colours
KEY_ACTION_INVERT = Couleurs inversées
+# (WHAT: Action key, WHERE: ContactDetails)
+# Show the photo in 'fullscreen'
KEY_ACTION_FULLSCREEN = Plein écran
+# (WHAT: Action key, WHERE: ContactList, ContactDetails, ContactDetailsRaw)
+# Switch between the available display formats
KEY_ACTION_SWITCH_FORMAT = Autre affichage
# (WHAT: Action key, WHERE: Contact list, Edit Contact)
# Add a new contact/field
# (WHAT: Error, WHERE: Contact list, FORMAT: %s = contact name)
# cannot delete a contact
ERR_CANNOT_DELETE_CONTACT = Impossible de supprimer "%s"
+# (WHAT: CLI --help)
+# The Help message header line
+CLI_HELP = jVCard est un petit programme de gestion de contacts écrit en Java\n\
+Il supporte les formats VCF et aBook, même s'il utilise VCF en interne\n\
+La dernière version est disponible sur https://github.com/nikiroo/jvcard
+# (WHAT: CLI --help)
+# The Help message line before explaining the different modes
+CLI_HELP_MODES = Vous pouvez lancer jvcard sous différents modes :
+# (WHAT: CLI --help)
+# The Help message line for help usage
+CLI_HELP_MODE_HELP = affiche cet écran d'aide
+# (WHAT: CLI --help)
+# The Help message line for contact manager usage
+CLI_HELP_MODE_CONTACT_MANAGER = démarre le gestionnaire de contacts
+# (WHAT: CLI --help)
+# The Help message line for contact manager usage
+CLI_HELP_MODE_I18N = génère les fichiers de traduction pour LANG dans DIR
+# (WHAT: CLI --help)
+# The Help message line for jVCard server usage
+CLI_HELP_MODE_SERVER = démarre jVCard Remote Server sur le port PORT
+# (WHAT: CLI --help)
+# The Help message line for --load-photo usage
+CLI_HELP_MODE_LOAD_PHOTO = charge les photos des contacts (en suivant FORMAT) depuis DIR
+# (WHAT: CLI --help)
+# The Help message line for --save-photo usage
+CLI_HELP_MODE_SAVE_PHOTO = sauve les photos des contacts (en suivant FORMAT) dans DIR
+# (WHAT: CLI --help)
+# The Help message line for config save usage
+CLI_HELP_MODE_SAVE_CONFIG = exporte les fichiers de configuration dans DIR
+# (WHAT: CLI --help)
+# The Help message line before the list of options
+CLI_HELP_OPTIONS = Les options suivantes sont supportées :
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_DD = arrête de chercher après d'autres options
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_LANG = force la langue LANG manuellement
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_GUI = force l'émulateur de terminal SWING
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_TUI = force le mode texte (et supporte les JRE headless)
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_NOUTF = évite l'utilisation de UTF-8, utilise le format ASCII
+# (WHAT: CLI --help)
+# The Help message line for: --
+CLI_HELP_CONFIG = cherche les fichiers de configuration dans DIR
+# (WHAT: CLI --help)
+# The Help message footer about files and jvcard:// links
+CLI_HELP_FOOTER = Tous les autres paramètres sont pris comme étant des cartes :\n\
+\t- les fichiers se terminant par .vcf seront ouvert comme VCF\n\
+\t- les fichiers ne se terminant pas par .vcf seront ouvert comme aBook\n\
+\t- les répertoires seront scannées pour y chercher des cartes (non récursivement)\n\
+\t- les cartes distantes "jvcard://server:port/name" sont supportées\n\
+\t- les listes de cartes distantes "jvcard://server:port/" sont supportées
+# (WHAT: CLI ERROR, FORMAT: %s = the error)
+# Syntax error: SOME TEXT
+CLI_SERR = Erreur de syntaxe: %s
+# (WHAT: CLI ERROR)
+# More than one mode given
+CLI_SERR_MODES = you can only use one of: \n\
+\t--server\n\
+\t--save-config\n\
+\t--i18n\n\
+\t--load-photo\n\
+\t--save-photo
+# (WHAT: CLI ERROR)
+# --lang is required
+CLI_SERR_NOLANG = language is required
+# (WHAT: CLI ERROR)
+# The dir is required
+CLI_SERR_NODIR = directory is required
+# (WHAT: CLI ERROR)
+# The port is required
+CLI_SERR_NOPORT = port is required
+# (WHAT: CLI ERROR)
+# The format is required
+CLI_SERR_NOFORMAT = format is required
+# (WHAT: CLI ERROR, FORMAT: %s = bad port)
+# The port is not valid
+CLI_SERR_BADPORT = not a valid port: %
+# (WHAT: CLI ERROR, FORMAT: %s = mode)
+# Card files are not supported in mode %s
+CLI_SERR_CANNOT_CARDS = cards are not supported in mode %s
+# (WHAT: CLI ERROR, FORMAT: %s = the error)
+# Error: SOME TEXT
+CLI_ERR = Erreur:
+# (WHAT: CLI ERROR)
+# No files given
+CLI_ERR_NOFILES = no cards to open
+# (WHAT: CLI ERROR, FORMAT: %s = dir)
+# Cannot create conf dir %s
+CLI_ERR_CANNOT_CREATE_CONFDIR = cannot create configuration directory: %s
+# (WHAT: CLI ERROR)
+# Remoting not available
+CLI_ERR_NO_REMOTING = remoting support not available
+# (WHAT: CLI ERROR)
+# TUI not available
+CLI_ERR_NO_TUI = TUI support not available
+# (WHAT: CLI ERROR, FORMAT: %s = dir)
+# Cannot create/update language in dir %s
+CLI_ERR_CANNOT_CREATE_LANG = cannot create/update the language file in: %s
+# (WHAT: CLI ERROR, FORMAT: %s = card)
+# Cannot open card %s
+CLI_ERR_CANNOT_OPEN = cannot open card: %s
+# (WHAT: CLI ERROR, FORMAT: %s = contact FN)
+# Cannot save photo of contact %s
+CLI_ERR_CANNOT_SAVE_PHOTO = cannot save photo of contact: %s
+# (WHAT: CLI ERROR)
+# Cannot start the program with the given cards
+CLI_ERR_CANNOT_START = cannot start the program with the given cards
@Override
public List<KeyAction> getKeyBindings() {
- // TODO Auto-generated method stub
List<KeyAction> actions = new LinkedList<KeyAction>();
- // TODO: add, remove
actions.add(new KeyAction(Mode.ASK_USER, KeyType.Enter,
- StringId.DUMMY) {
+ StringId.KEY_ACTION_EDIT_FIELD) {
@Override
public Object getObject() {
return getSelectedData();
return "Cannot modify value";
}
});
- actions.add(new KeyAction(Mode.ASK_USER_KEY, 'd', StringId.DUMMY) {
+ actions.add(new KeyAction(Mode.ASK_USER_KEY, 'd',
+ StringId.KEY_ACTION_DELETE) {
@Override
public Object getObject() {
return getSelectedData();
}
});
// TODO: ui
- actions.add(new KeyAction(Mode.ASK_USER, 'a', StringId.DUMMY) {
+ actions.add(new KeyAction(Mode.ASK_USER, 'a', StringId.KEY_ACTION_ADD) {
@Override
public Object getObject() {
return contact;
}
});
actions.add(new KeyAction(Mode.ASK_USER_KEY, 'd',
- StringId.KEY_ACTION_DELETE_CONTACT) {
+ StringId.KEY_ACTION_DELETE) {
@Override
public Object getObject() {
return getSelectedContact();