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 |
writeToExtractedMsgsFile(SoyMsgBundle msgBundle,
SoyMsgBundleHandler.OutputFileOptions options,
File outputFile)
Generates an extracted messages file (source messages to be translated) from a given message
bundle, and writes it to file.
|
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.
|
@Inject public SoyMsgBundleHandler(SoyMsgPlugin msgPlugin)
public SoyMsgBundle createFromFile(File inputFile) throws IOException, SoyMsgException
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, SoyMsgException
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 writeToExtractedMsgsFile(SoyMsgBundle msgBundle, SoyMsgBundleHandler.OutputFileOptions options, File outputFile) throws IOException, SoyMsgException
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 extracted 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.SoyMsgException - If there's an error while processing the messages.IOException - If there's an error while accessing the file.public void writeToTranslatedMsgsFile(SoyMsgBundle msgBundle, SoyMsgBundleHandler.OutputFileOptions options, File outputFile) throws IOException, SoyMsgException
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.