Package com.google.transconsole.common.messages

Examples of com.google.transconsole.common.messages.MessageBundle


      List<ExtractedMessage> messages = Lists.newArrayList();
      for (CompilationUnit cUnit : extractMessagesFrom) {
        messages.addAll(cUnit.getMessageExtractedTree().getMessages());
      }

      MessageBundle messageBundle = Util.bundleMessages(alertSink, messages);
      PropertiesBundleWriter pbw = new PropertiesBundleWriter(messageBundle);
      try {
        Writer writer = propertiesFile.openWriter(Charsets.US_ASCII);
        try {
          pbw.write(writer);
View Full Code Here


  }

  public void generateCode(Appendable out, AlertSink alertSink) throws IOException {
    alertSink.addAll(tree.getAlerts());

    MessageBundle messageBundle = Util.bundleMessages(alertSink, tree.getMessages());
    XmbBundleWriter bundleWriter = new XmbBundleWriter(messageBundle);
    bundleWriter.write(XML_ASCII_ESCAPER.escape(out));
  }
View Full Code Here

  /**
   * Build a {@code MessageBundle} from a {@code List} of {@code ExtractedMessage}s.
   */
  public static MessageBundle bundleMessages(AlertSink alertSink,
                                             List<ExtractedMessage> messages) {
    MessageBundle messageBundle = new MessageBundle(PROJECT_ID, LANGUAGE_ID);
    for (ExtractedMessage msg : messages) {
      try {
        messageBundle.addMessage(msg.getTcMessage());
      } catch (InvalidMessageBundleException e) {
        alertSink.add(new InvalidMessageError(msg.getSourcePosition(), e.getCause()));
      }
    }
    return messageBundle;
View Full Code Here

TOP

Related Classes of com.google.transconsole.common.messages.MessageBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.