In order for Inkscape to make use of an external script or program, you must describe that script to inkscape using an INX file. See the inkscape share directory for examples. The INX file allows the author to:

+

* label strings for translation

+

* define parameters

+

* chain extensions

+

* etc

+

Be sure to read through the INX files that come with Inkscape. Nothing beats a working example.

−

The inkscape call a program with some arguments and as the last argumet it tells to the extension program where is the temporay SVG file to do the work. The temporay SVG file represents the actual state of the working SVG.

+

== Translation of extensions ==

−

After the extension program work it writes the modified SVG to the default output, the Inkscape get this and update the SVG for the user.

+

Extension dialog windows, described in INX files, can be prepared for translation or localisation by adding an <code>_</code> (underscore) to the XML tags or attributes. Only add underscores when text need to be translated (not numeric values, for example!).

When extensions are included in the [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/share/extensions/ Inkscape BZR Repository], various scripts will scan each INX file for translatable text and prepare [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/files/head%3A/po/ translation files] for others to translate.

The XML schema for ING files is available in the [http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/annotate/head%3A/share/extensions/inkscape.extension.rng Inkscape BZR repository]. This is a [http://www.relaxng.org/ RELAX NG schema].

+

+

A compactly formatted version of the schema (created on 2 November 2010 using [http://www.thaiopensource.com/relaxng/trang.html Trang]):

+

<small><pre>

+

default namespace =

+

"http://www.inkscape.org/namespace/inkscape/extension"

+

+

start =

+

element inkscape-extension {

+

element _name { text },

+

element id { text },

+

element dependency {

+

attribute type { inx.dependency-type.values },

+

attribute location { inx.location.values }?,

+

attribute _description { text }?,

+

text

+

}*,

+

(inx.parameters

+

| element param {

+

attribute name { text },

+

attribute type { "notebook" },

+

element page {

+

attribute name { text },

+

attribute _gui-text { text },

+

inx.parameters+

+

}+

+

})*,

+

(element input {

+

inx.io.common,

+

element output_extension { text }?

+

}

+

| element output {

+

inx.io.common,

+

element dataloss { xsd:boolean }?

+

}

+

| element effect {

+

attribute needs-document { xsd:boolean }?,

+

attribute needs-live-preview { xsd:boolean }?,

+

element object-type {

+

xsd:token "all" | xsd:token "path" | xsd:token "rect"

+

},

+

element effects-menu {

+

attribute hidden { xsd:boolean "true" }

+

| element submenu {

+

attribute _name { text },

+

empty

+

}

+

}

+

}

+

| element path-effect { empty }

+

| element print { empty }),

+

(element script {

+

element command {

+

inx.reldir.attr,

+

attribute interpreter { "python" | "perl" }?,

+

text

+

},

+

element helper_extension { xsd:NMTOKEN }?,

+

element check { inx.reldir.attr, text }*

+

}

+

| element xslt {

+

element file { inx.reldir.attr, text }

+

}

+

| element plugin {

+

element name { text }

+

})

+

}

+

inx.reldir.attr = attribute reldir { inx.location.values }

+

inx.location.values = "extensions" | "path" | "plugins"

+

inx.dependency-type.values = "extension" | "executable" | "plugin"

+

inx.io.common =

+

element extension { text },

+

element mimetype { text },

+

element _filetypename { text }?,

+

element _filetypetooltip { text }?

+

inx.parameter =

+

attribute name { xsd:token },

+

attribute gui-hidden { xsd:boolean }?,

+

attribute _gui-text { text }?,

+

((attribute type { "int" },

+

attribute min { xsd:integer }?,

+

attribute max { xsd:integer }?,

+

(empty | xsd:integer))

+

| (attribute type { "float" },

+

attribute precision { xsd:integer }?,

+

attribute min { xsd:float }?,

+

attribute max { xsd:float }?,

+

xsd:float)

+

| (attribute type { "boolean" },

+

xsd:boolean)

+

| (attribute type { "string" },

+

attribute max_length { xsd:integer }?,

+

(empty | text))

+

| (attribute type { "description" },

+

text)

+

| (attribute type { "enum" },

+

(element _item { inx.parameter.enum.item }

+

| element item { inx.parameter.enum.item })+)

+

| (attribute type { "optiongroup" },

+

attribute appearance { "minimal" }?,

+

(element option { inx.parameter.optiongroup.option }

+

| element _option { inx.parameter.optiongroup.option })+))

+

inx.parameters =

+

element param { inx.parameter }

+

| element _param { inx.parameter }

+

inx.parameter.enum.item =

+

attribute value { text },

+

xsd:token

+

inx.parameter.optiongroup.option =

+

attribute value { text }?,

+

text

+

</pre></small>

== See Also ==

== See Also ==

−

[[ScriptingHOWTO]]

+

*[[INX Parameters]]

+

*[[ScriptingHOWTO]]

[[Category:Developer Documentation]]

[[Category:Developer Documentation]]

[[Category:Help Wanted]]

[[Category:Help Wanted]]

[[Category:Extensions]]

[[Category:Extensions]]

Latest revision as of 15:38, 19 March 2017

Contents

Introduction

In order for Inkscape to make use of an external script or program, you must describe that script to inkscape using an INX file. See the inkscape share directory for examples. The INX file allows the author to:

label strings for translation

define parameters

chain extensions

etc

Be sure to read through the INX files that come with Inkscape. Nothing beats a working example.

Translation of extensions

Extension dialog windows, described in INX files, can be prepared for translation or localisation by adding an _ (underscore) to the XML tags or attributes. Only add underscores when text need to be translated (not numeric values, for example!).