|
|
| (2 intermediate revisions by 2 users not shown) |
| Line 1: |
Line 1: |
| ==Adding Translation Capability==
| | The documentation for writing new extensions has been moved to the [https://inkscape.gitlab.io/extensions/documentation/authors/index.html documentation of the extensions repository.] |
| | |
| One can add the ability to have Python text mesages included for translation. To provide an error message, rather than using the Python <tt>sys.stderr</tt>, use the provided <tt>errormsg()</tt> function from inkex.py in conjuction with <tt>gettext</tt>.
| |
| | |
| You must include the following at the beginning of your Python script:
| |
| import inkex
| |
| import gettext
| |
| _ = gettext.gettext
| |
| | |
| Note: Changes are likely to occur in 0.49. To enable messages translation, you will have to include the following lines instead:
| |
| import inkex
| |
| inkex.localize()
| |
| | |
| Where you wish to have an error message, write the following:
| |
| inkex.errormsg(_("This will be written to Python stderr"))
| |
| | |
| Of course, you may also change "_" to something else if you wish.
| |
| | |
| [[Category:Extensions]]
| |
Latest revision as of 20:50, 10 March 2022
The documentation for writing new extensions has been moved to the documentation of the extensions repository.