src/share/classes/com/sun/tools/javac/util/Log.java

changeset 604
a5454419dd46
parent 584
d1ea43cb71c1
child 664
4124840b35fe
     1.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java	Mon Jul 12 16:37:46 2010 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Tue Jul 13 19:14:09 2010 -0700
     1.3 @@ -269,7 +269,7 @@
     1.4       */
     1.5      public void prompt() {
     1.6          if (promptOnError) {
     1.7 -            System.err.println(getLocalizedString("resume.abort"));
     1.8 +            System.err.println(localize("resume.abort"));
     1.9              char ch;
    1.10              try {
    1.11                  while (true) {
    1.12 @@ -317,8 +317,23 @@
    1.13          if (msg.length() != 0) writer.println(msg);
    1.14      }
    1.15  
    1.16 +    /** Print the text of a message to the errWriter stream,
    1.17 +     *  translating newlines appropriately for the platform.
    1.18 +     */
    1.19 +    public void printErrLines(String key, Object... args) {
    1.20 +        printLines(errWriter, localize(key, args));
    1.21 +    }
    1.22 +
    1.23 +
    1.24 +    /** Print the text of a message to the noticeWriter stream,
    1.25 +     *  translating newlines appropriately for the platform.
    1.26 +     */
    1.27 +    public void printNoteLines(String key, Object... args) {
    1.28 +        printLines(noticeWriter, localize(key, args));
    1.29 +    }
    1.30 +
    1.31      protected void directError(String key, Object... args) {
    1.32 -        printLines(errWriter, getLocalizedString(key, args));
    1.33 +        printErrLines(key, args);
    1.34          errWriter.flush();
    1.35      }
    1.36  
    1.37 @@ -426,6 +441,8 @@
    1.38      }
    1.39  
    1.40      /** Find a localized string in the resource bundle.
    1.41 +     *  Because this method is static, it ignores the locale.
    1.42 +     *  Use localize(key, args) when possible.
    1.43       *  @param key    The key for the localized string.
    1.44       *  @param args   Fields to substitute into the string.
    1.45       */
    1.46 @@ -433,6 +450,14 @@
    1.47          return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args);
    1.48      }
    1.49  
    1.50 +    /** Find a localized string in the resource bundle.
    1.51 +     *  @param key    The key for the localized string.
    1.52 +     *  @param args   Fields to substitute into the string.
    1.53 +     */
    1.54 +    public String localize(String key, Object... args) {
    1.55 +        return messages.getLocalizedString("compiler.misc." + key, args);
    1.56 +    }
    1.57 +
    1.58  /***************************************************************************
    1.59   * raw error messages without internationalization; used for experimentation
    1.60   * and quick prototyping

mercurial