Changeset 12892 in josm for trunk/src/gnu/getopt
- Timestamp:
- 2017-09-24T09:25:26+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gnu/getopt/Getopt.java
r10209 r12892 21 21 package gnu.getopt; 22 22 23 import static org.openstreetmap.josm.tools.I18n.tr;24 25 23 import java.text.MessageFormat; 26 24 import java.util.HashMap; 27 25 import java.util.Map; 26 import java.util.function.Function; 28 27 29 28 /**************************************************************************/ … … 582 581 /**************************************************************************/ 583 582 583 private static Function<String, String> tr = Function.identity(); 584 585 /** 586 * Set the global translation handler for Getopt. 587 * 588 * This needs to be done before any call to {@link Getopt} or {@link LongOpt} 589 * constructor. 590 * @param tr function that takes messages in English and returns the localized message 591 */ 592 public static void setI18nHandler(Function<String, String> tr) { 593 Getopt.tr = tr; 594 } 595 584 596 static class OptI18n { 597 598 private final Map<String, String> trns = new HashMap<>(); 599 585 600 public OptI18n() { 586 601 add("getopt.ambigious", tr("{0}: option ''{1}'' is ambiguous")); … … 596 611 } 597 612 598 Map<String, String> trns = new HashMap<String, String>(); 613 private String tr(String s) { 614 return Getopt.tr.apply(s); 615 } 599 616 600 617 private void add(String key, String value) {
Note:
See TracChangeset
for help on using the changeset viewer.