Some translations come with gnu getopt, but we support more languages. Therefore this patch switches to the normal JOSM I18n framework. Index: core/src/gnu/getopt/Getopt.java =================================================================== --- core.orig/src/gnu/getopt/Getopt.java 2012-06-18 01:11:14.320660615 +0200 +++ core/src/gnu/getopt/Getopt.java 2012-06-18 01:12:02.516661865 +0200 @@ -22,11 +22,9 @@ package gnu.getopt; -import static org.openstreetmap.josm.tools.I18n.tr; - +import java.util.Locale; +import java.util.ResourceBundle; import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Map; /**************************************************************************/ @@ -541,7 +539,8 @@ /** * The localized strings are kept in a separate file */ -private OptI18n _messages = new OptI18n(); // ResourceBundle.getBundle("gnu/getopt/MessagesBundle", Locale.getDefault()); +private ResourceBundle _messages = ResourceBundle.getBundle( + "gnu/getopt/MessagesBundle", Locale.getDefault()); /**************************************************************************/ @@ -583,33 +582,6 @@ /**************************************************************************/ -static class OptI18n { - public OptI18n() { - add("getopt.ambigious", tr("{0}: option ''{1}'' is ambiguous")); - add("getopt.arguments1", tr("{0}: option ''--{1}'' does not allow an argument")); - add("getopt.arguments2", tr("{0}: option ''{1}{2}'' does not allow an argument")); - add("getopt.requires", tr("{0}: option ''{1}'' requires an argument")); - add("getopt.unrecognized", tr("{0}: unrecognized option ''--{1}''")); - add("getopt.unrecognized2", tr("{0}: unrecognized option ''{1}{2}''")); - add("getopt.illegal", tr("{0}: illegal option -- {1}")); - add("getopt.invalid", tr("{0}: invalid option -- {1}")); - add("getopt.requires2", tr("{0}: option requires an argument -- {1}")); - add("getopt.invalidValue", tr("Invalid value {0} for parameter ''has_arg''")); - } - - Map trns = new HashMap(); - - private void add(String key, String value) { - trns.put(key, value); - } - - public String getString(String s) { - String val = trns.get(s); - if (val == null) throw new IllegalArgumentException(); - return val.replace("'", "''"); - } -} - /** * Construct a Getopt instance with given input data that is capable of * parsing long options and short options. Contrary to what you might @@ -646,8 +618,8 @@ else { posixly_correct = true; - _messages = new OptI18n();//ResourceBundle.getBundle("gnu/getopt/MessagesBundle", - // Locale.US); + _messages = ResourceBundle.getBundle("gnu/getopt/MessagesBundle", + Locale.US); } // Determine how to handle the ordering of options and non-options Index: core/src/gnu/getopt/LongOpt.java =================================================================== --- core.orig/src/gnu/getopt/LongOpt.java 2012-06-18 01:11:14.400660615 +0200 +++ core/src/gnu/getopt/LongOpt.java 2012-06-18 01:12:02.524661863 +0200 @@ -99,7 +99,8 @@ /** * Localized strings for error messages */ -private Getopt.OptI18n _messages = new Getopt.OptI18n(); // ResourceBundle.getBundle("gnu/getopt/MessagesBundle", Locale.getDefault()); +private ResourceBundle _messages = ResourceBundle.getBundle( + "gnu/getopt/MessagesBundle", Locale.getDefault()); /**************************************************************************/