Index: trunk/src/gnu/getopt/Getopt.java
===================================================================
--- trunk/src/gnu/getopt/Getopt.java	(revision 10209)
+++ trunk/src/gnu/getopt/Getopt.java	(revision 12892)
@@ -21,9 +21,8 @@
 package gnu.getopt;
 
-import static org.openstreetmap.josm.tools.I18n.tr;
-
 import java.text.MessageFormat;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.function.Function;
 
 /**************************************************************************/
@@ -582,5 +581,21 @@
 /**************************************************************************/
 
+private static Function<String, String> tr = Function.identity();
+
+/**
+ * Set the global translation handler for Getopt.
+ *
+ * This needs to be done before any call to {@link Getopt} or {@link LongOpt}
+ * constructor.
+ * @param tr function that takes messages in English and returns the localized message
+ */
+public static void setI18nHandler(Function<String, String> tr) {
+    Getopt.tr = tr;
+}
+
 static class OptI18n {
+
+    private final Map<String, String> trns = new HashMap<>();
+
     public  OptI18n() {
         add("getopt.ambigious", tr("{0}: option ''{1}'' is ambiguous"));
@@ -596,5 +611,7 @@
     }
 
-    Map<String, String> trns = new HashMap<String, String>();
+    private String tr(String s) {
+        return Getopt.tr.apply(s);
+    }
 
     private void add(String key, String value) {
