Difference between revisions of "Extensions: INX widgets and parameters"
(→Common attributes: fix section links) |
(→Localization of parameters: New section that explains the underscore mechanism) |
||
Line 154: | Line 154: | ||
[[File:INX_sample-description_header.png]]<br><small>with <code>appearance="header"</code></small><br><br><br> | [[File:INX_sample-description_header.png]]<br><small>with <code>appearance="header"</code></small><br><br><br> | ||
|} | |} | ||
== Localization of parameters == | |||
To mark parameters to be included into the translation files (this is done automatically during the build process) there exist special variants of all relevant attributes and tag names that start with an underscore. | |||
* Labels and tooltips can be marked for translation by simply using the attribute names <code>_gui-text</code> and <code>_gui-description</code> instead of their counterparts without underscore. | |||
* For <code><item></code>s and <code><option></code>s (both of which do not use the attributes just explained) add an underscore to the tag name itself:<br><code><_item value="1">Localized item name</_item></code> and<br><code><_option value="1">Localized option name</_option></code> respectively. | |||
* Also for <code>description</code> type (and ''only'' for <code>description</code> type!) parameters an underscore is added to the tag name itself:<br><code><_param type="description">Localized text here.</_param></code> | |||
[[Category:Developer Documentation]] | [[Category:Developer Documentation]] | ||
[[Category:Extensions]] | [[Category:Extensions]] |
Revision as of 23:49, 26 November 2015
Here you will find the different parameter elements you may use in your .inx files (Inkscape Extensions)
Introduction
Use parameter elements to capture user input for further use by a script. The basic structure of the element is:
<param name="some_name" type="some_type">default value</param>
The default value is the value that is shown in the input control the first time the user opens the dialog window. Inkscape automatically displays the values used last time when the dialog window is opened again.
Common attributes
Type
The type
attribute determines the type of the parameter (possible values are boolean, int, float, string, enum, optiongroup, color, notebook, description
), see the extensive description of available types below.
Name
The value of the name
attribute is used as an identifier of the parameter. It has to be unique since the value of this attribute is used to save and transmit parameter values internally!
gui-text
Label of the parameter.
To enable translations for this string use the underscore variant (_gui-text
, see localization of parameters below for details).
gui-description
Tooltip of the parameter, which is shown when the user hovers the mouse cursor over the active area of the parameter in question.
To enable translations for this string use the underscore variant (_gui-description
, see localization of parameters below for details).
If the value is set to true
the parameter is hidden from the GUI (default to false).
Available types
Localization of parameters
To mark parameters to be included into the translation files (this is done automatically during the build process) there exist special variants of all relevant attributes and tag names that start with an underscore.
- Labels and tooltips can be marked for translation by simply using the attribute names
_gui-text
and_gui-description
instead of their counterparts without underscore. - For
<item>
s and<option>
s (both of which do not use the attributes just explained) add an underscore to the tag name itself:<_item value="1">Localized item name</_item>
and<_option value="1">Localized option name</_option>
respectively. - Also for
description
type (and only fordescription
type!) parameters an underscore is added to the tag name itself:<_param type="description">Localized text here.</_param>