Plugin source location: <serge_root>/lib/Serge/Engine/Plugin/parse_js.pm
This plugin is used to parse JavaScript object properties in "key" : "value"
format. It is also suitable to parse string maps in Go, since their syntax is very similar. Each key-value pair must be on its own line. If the line ends with a comment, it will be extracted as an additional hint as well. If the string key is identical to the string itself, it will not be used as a hint (since such a hint adds no value).
Note that this parser supports only a subset of syntax and does no validation. It is targeted for arbitrary source code files. If your resource file is rather a well-formed JSON that can be strictly validated, you can use the parse_json_keyvalue plugin instead.
var localizations = {
// whitespace before and afer colon is ignored:
"key1" : "string 1",
"key2": "string 2",
"key3":"string 3",
// You can add extra comment after a particular line that
// will be extracted. Comments have to start with `//`.
// Space around `//` is ignored:
"key4": "string 4", // additional comment for string 4
"key5": "string 5",//additional comment for string 5
"key6": "string 6", // additional comment for string 6
// single quotes around string literals are supported
// for both keys and values:
'key7': 'string 7',
// a mix of single and double quotes is allowed:
'key8': "string 8",
"key9": 'string 9',
// unquoted key names are allowed as well:
key10: "string 10"
};
Note: multi-line strings (strings with concatenation) are not supported.