source:
josm/trunk/patches/30gettext_i18n.patch@
11135
Last change on this file since 11135 was 5337, checked in by , 12 years ago | |
---|---|
File size: 3.6 KB |
-
src/gnu/getopt/Getopt.java
Some translations come with gnu getopt, but we support more languages. Therefore this patch switches to the normal JOSM I18n framework.
old new 22 22 23 23 package gnu.getopt; 24 24 25 import static org.openstreetmap.josm.tools.I18n.tr;26 25 import java.util.Locale; 26 import java.util.ResourceBundle; 27 27 import java.text.MessageFormat; 28 import java.util.HashMap;29 import java.util.Map;30 28 31 29 /**************************************************************************/ 32 30 … … 541 539 /** 542 540 * The localized strings are kept in a separate file 543 541 */ 544 private OptI18n _messages = new OptI18n(); // ResourceBundle.getBundle("gnu/getopt/MessagesBundle", Locale.getDefault()); 542 private ResourceBundle _messages = ResourceBundle.getBundle( 543 "gnu/getopt/MessagesBundle", Locale.getDefault()); 545 544 546 545 /**************************************************************************/ 547 546 … … 583 582 584 583 /**************************************************************************/ 585 584 586 static class OptI18n {587 public OptI18n() {588 add("getopt.ambigious", tr("{0}: option ''{1}'' is ambiguous"));589 add("getopt.arguments1", tr("{0}: option ''--{1}'' does not allow an argument"));590 add("getopt.arguments2", tr("{0}: option ''{1}{2}'' does not allow an argument"));591 add("getopt.requires", tr("{0}: option ''{1}'' requires an argument"));592 add("getopt.unrecognized", tr("{0}: unrecognized option ''--{1}''"));593 add("getopt.unrecognized2", tr("{0}: unrecognized option ''{1}{2}''"));594 add("getopt.illegal", tr("{0}: illegal option -- {1}"));595 add("getopt.invalid", tr("{0}: invalid option -- {1}"));596 add("getopt.requires2", tr("{0}: option requires an argument -- {1}"));597 add("getopt.invalidValue", tr("Invalid value {0} for parameter ''has_arg''"));598 }599 600 Map<String, String> trns = new HashMap<String, String>();601 602 private void add(String key, String value) {603 trns.put(key, value);604 }605 606 public String getString(String s) {607 String val = trns.get(s);608 if (val == null) throw new IllegalArgumentException();609 return val.replace("'", "''");610 }611 }612 613 585 /** 614 586 * Construct a Getopt instance with given input data that is capable of 615 587 * parsing long options and short options. Contrary to what you might … … 646 618 else 647 619 { 648 620 posixly_correct = true; 649 _messages = new OptI18n();//ResourceBundle.getBundle("gnu/getopt/MessagesBundle",650 //Locale.US);621 _messages = ResourceBundle.getBundle("gnu/getopt/MessagesBundle", 622 Locale.US); 651 623 } 652 624 653 625 // Determine how to handle the ordering of options and non-options -
src/gnu/getopt/LongOpt.java
old new 99 99 /** 100 100 * Localized strings for error messages 101 101 */ 102 private Getopt.OptI18n _messages = new Getopt.OptI18n(); // ResourceBundle.getBundle("gnu/getopt/MessagesBundle", Locale.getDefault()); 102 private ResourceBundle _messages = ResourceBundle.getBundle( 103 "gnu/getopt/MessagesBundle", Locale.getDefault()); 103 104 104 105 /**************************************************************************/ 105 106
Note:
See TracBrowser
for help on using the repository browser.