|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.google.javascript.jscomp.JsMessageExtractor
public class JsMessageExtractor
Extracts messages and message comments from JS code.
Uses a special prefix (e.g. MSG_
) to determine which variables
are messages. Here are the recognized formats:
var MSG_FOO = "foo";
var MSG_FOO_HELP = "this message is used for foo";
var MSG_BAR = function(a, b) {
return a + " bar " + b;
}
var MSG_BAR_HELP = "the bar message";
This class enforces the policy that message variable names must be unique across all JS files.
Constructor Summary | |
---|---|
JsMessageExtractor(JsMessage.IdGenerator idGenerator,
JsMessage.Style style)
|
Method Summary | ||
---|---|---|
|
extractMessages(Iterable<T> inputs)
Extracts js messages from javascript code. |
|
Collection<JsMessage> |
extractMessages(SourceFile... inputs)
Extracts js messages from javascript code. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JsMessageExtractor(JsMessage.IdGenerator idGenerator, JsMessage.Style style)
Method Detail |
---|
public Collection<JsMessage> extractMessages(SourceFile... inputs) throws IOException
IOException
public <T extends SourceFile> Collection<JsMessage> extractMessages(Iterable<T> inputs) throws IOException
inputs
- the javascript source code inputs
IOException
- if there is a problem reading the js code
RuntimeException
- if there are problems parsing the js code or the
js messages, or if two messages have the same key
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |