public class SoyMsgBundleHandler extends Object
SoyMsgBundles to file format and for creating SoyMsgBundles
from files or resources.
Uses a SoyMsgPlugin to do the actual generation of the output data and the actual
parsing of the input data. The SoyMsgPlugin implements the specific message file format.
| Modifier and Type | Class and Description |
|---|---|
static class |
SoyMsgBundleHandler.OutputFileOptions
Options for generating an output messages file.
|
| Constructor and Description |
|---|
SoyMsgBundleHandler(SoyMsgPlugin msgPlugin) |
| Modifier and Type | Method and Description |
|---|---|
SoyMsgBundle |
createFromFile(File inputFile)
Reads a translated messages file and creates a SoyMsgBundle.
|
SoyMsgBundle |
createFromResource(URL inputResource)
Reads a translated messages resource and creates a SoyMsgBundle.
|
void |
writeExtractedMsgs(SoyMsgBundle msgBundle,
SoyMsgBundleHandler.OutputFileOptions options,
com.google.common.io.ByteSink output,
ErrorReporter errorReporter)
Generates extracted messages (source messages to be translated) from a given message bundle,
and writes it out.
|
void |
writeToTranslatedMsgsFile(SoyMsgBundle msgBundle,
SoyMsgBundleHandler.OutputFileOptions options,
File outputFile)
Generates an translated messages file (source messages to be translated) from a given message
bundle, and writes it to file.
|
public SoyMsgBundleHandler(SoyMsgPlugin msgPlugin)
public SoyMsgBundle createFromFile(File inputFile) throws IOException
inputFile - The input file to read from.IOException - If there's an error while accessing the file.SoyMsgException - If there's an error while processing the messages.public SoyMsgBundle createFromResource(URL inputResource) throws IOException
inputResource - The resource to read from.IOException - If there's an error while accessing the resource.SoyMsgException - If there's an error while processing the messages.public void writeExtractedMsgs(SoyMsgBundle msgBundle, SoyMsgBundleHandler.OutputFileOptions options, com.google.common.io.ByteSink output, ErrorReporter errorReporter) throws IOException
Important: Do not use outside of Soy code (treat as superpackage-private).
msgBundle - The message bundle to write.options - The options for generating the output extracted messages (depending on the
message plugin being used, none or some of the options may be applicable).output - The output to write to.errorReporter - For reporting errors.SoyMsgException - If there's an error while processing the messages.IOException - If there's an error writing the messages.public void writeToTranslatedMsgsFile(SoyMsgBundle msgBundle, SoyMsgBundleHandler.OutputFileOptions options, File outputFile) throws IOException
Important: Do not use outside of Soy code (treat as superpackage-private).
msgBundle - The message bundle to write to file.options - The options for generating the output translated messages file (depending on the
message plugin being used, none or some of the options may be applicable).outputFile - The output file to write to.IOException - If there's an error while accessing the file.SoyMsgException - If there's an error while processing the messages.