| 200 | When you are defining the settings of an '''xml''' extractor, the `keywords` property is an object where each property name is the name of an XML element. The extractor extracts the text within the start and end tags of XML elements with the specified name. The value of the property is an object of optional settings (you can provide an empty object). For example: |
| 201 | |
| 202 | {{{ |
| 203 | "keywords": { |
| 204 | "Name": {}, |
| 205 | "Description": {} |
| 206 | } |
| 207 | }}} |
| 208 | |
| 209 | From `<Name>Jane</Name>`, the settings above would make the extractor extract `Jane`. |
| 210 | |
| 211 | The settings object may contain any of the following settings: |
| 212 | |
| 213 | * '''extractJson'''. This property allows you to extract messages from a JSON string defined within an XML element. The value of this property should be an object of options for the '''json''' extractor. For example, from `<Name>{ "female": "Jane", "male": "John" }</Name>`, `"keywords": { "Name": { "extractJson": { "keywords": ["female", "male"] } } }` would make the extractor extract both `Jane` and `John`. |
| 214 | |
| 215 | * '''tagAsContext'''. Set this property to any value (e.g. `true`) to make extracted messages have the XML tag name as translation context. See [wiki:Internationalization#UsingContextFunctions Internationalization, Using Context Functions]. |
| 216 | |
| 217 | * '''customContext'''. Add a custom context to all extracted strings with this keyword. |
| 218 | |
| 219 | * '''locationAttributes'''. This property allows to specify a list of XML attributes that may be helpful to identify the source location of the extracted message. These XML attributes, if found, are appended to the source path of the extracted message in the translation template file. If nothing else, the value of some attributes may help translators understand the context of the message. For example, for some languages it is important to know whether the message comes from a tooltip or a caption; if you use `"locationAttributes": ["id"]` when parsing GUI XML files, translators will see the message source as `path/to/gui/file.xml:123 (caption)` and not just `path/to/gui/file.xml:123`. |
| 220 | |
212 | | * If the value is an object, the extractor extracts the value of every property of the object that is a string. For example, from `"Name": { "female": "Jane", "male": "John" }`, it extracts both `Jane` and `John`. |
213 | | |
214 | | When you are defining the settings of an '''xml''' extractor, the `keywords` property is an object where each property name is the name of an XML element. The extractor extracts the text within the start and end tags of XML elements with the specified name. The value of the property is an object of optional settings (you can provide an empty object). For example: |
215 | | |
216 | | {{{ |
217 | | "keywords": { |
218 | | "Name": {}, |
219 | | "Description": {} |
220 | | } |
221 | | }}} |
222 | | |
223 | | From `<Name>Jane</Name>`, the settings above would make the extractor extract `Jane`. |
224 | | |
225 | | The settings object may contain any of the following settings: |
226 | | |
227 | | * '''extractJson'''. This property allows you to extract messages from a JSON string defined within an XML element. The value of this property should be an object of options for the '''json''' extractor. For example, from `<Name>{ "female": "Jane", "male": "John" }</Name>`, `"keywords": { "Name": { "extractJson": { "keywords": ["female", "male"] } } }` would make the extractor extract both `Jane` and `John`. |
228 | | |
229 | | * '''tagAsContext'''. Set this property to any value (e.g. `true`) to make extracted messages have the XML tag name as translation context. See [wiki:Internationalization#UsingContextFunctions Internationalization, Using Context Functions]. |
230 | | |
231 | | * '''locationAttributes'''. This property allows to specify a list of XML attributes that may be helpful to identify the source location of the extracted message. These XML attributes, if found, are appended to the source path of the extracted message in the translation template file. If nothing else, the value of some attributes may help translators understand the context of the message. For example, for some languages it is important to know whether the message comes from a tooltip or a caption; if you use `"locationAttributes": ["id"]` when parsing GUI XML files, translators will see the message source as `path/to/gui/file.xml:123 (caption)` and not just `path/to/gui/file.xml:123`. |
| 233 | * If the value is an object, the extractor extracts the string with keyword `"_string"`. Furthermore one can set the options '''tagAsContext''' and '''customContext''' similar to the xml. |
| 234 | * If the setting '''extractFromInnerKeys''' is set to `true`, then the value of every property of the object will be extracted, using the previous rules. For example, from `"Name": { "female": "Jane", "male": "John" }`, it extracts both `Jane` and `John`. |