serge-test-parser - Test parser against any given file
serge test-parser <parser_name> <file_path> [--import-mode] [--output-mode=<mode>] [--data-file=<file_path>]
Where <parser_name> is a class name of the parser, and <file_path> is a path to the localizable file to test this parser on.
<parser_name>
<file_path>
Note that you can omit the Serge::Engine::Plugin:: prefix of the parser class name if your parser is located in lib/Serge/Engine/Plugin folder. Consider the following examples of <parser_name> parameter:
Serge::Engine::Plugin::
Use Serge::Engine::Plugin::parse_android parser class.
Serge::Engine::Plugin::parse_android
Same as above (explicit class declaration).
Use ACME::Parser parser class.
ACME::Parser
Parse the given file using the selected parser and emit the resulting data in one of the available formats. This is useful for writing new parsers.
With this option, parser will be told it works in import mode. In such mode import-aware parsers are expected to extract translations rather than source strings, and also skip missing translations.
By default, parsed data will be emitted in an easily readable Config::Neat format (the format used in Serge configuration files). Such files are also suitable for diff. However, there are alternative output modes available:
Use Data::Dumper to dump the parsed structure. The format is a bit verbose, but can be handy for debugging.
By default, parsed data is rendered as an array of arrays; each inner array holds fields in the following order: string, context, hint, flagsref, lang, key. With --as-objects, the data will be rendered as an array of objects with corresponding key names for better readability.
Some parsers require configuration data. You can pass data structure to the parser using this parameter. Target file should be a configuration file in Config::Neat format with the parser data that you would usually put into jobs > ... > parser > data section of Serge configuration file.
jobs > ... > parser > data
Part of serge suite.
To install Serge, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Serge
CPAN shell
perl -MCPAN -e shell install Serge
For more information on module installation, please visit the detailed CPAN module installation guide.