diff options
| author | Viatrix | 2026-03-13 09:05:40 -0700 |
|---|---|---|
| committer | Viatrix | 2026-03-13 09:05:40 -0700 |
| commit | 4917d1fea4ed29a7030dec5a9304dccd5a76dd23 (patch) | |
| tree | d07f0119e276f2a0e08a8ad15b105b5e2f8d1811 | |
| parent | d79da3d0f945729ccba28b477fb2035e91041460 (diff) | |
String cleanup, actually does translation correctly
| -rw-r--r-- | imagemap.inx | 17 | ||||
| -rw-r--r-- | imagemap.py | 6 |
2 files changed, 13 insertions, 10 deletions
diff --git a/imagemap.inx b/imagemap.inx index 96d13a0..fb088bd 100644 --- a/imagemap.inx +++ b/imagemap.inx @@ -1,18 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension"> - <name>Generate Image Map</name> +<inkscape-extension translationdomain="imagemap" xmlns="http://www.inkscape.org/namespace/inkscape/extension"> + <name>Save as Image Map</name> <id>computer.viatrix.inx.imagemap</id> + <description>Adds Web image maps as a format in the Save dialog.</description> + <param type="optiongroup" appearance="radio" name="maptype" gui-text="Map Type"> + <option value="HTML" translatable="no">HTML</option> + <option value="XHTML" translatable="no">XHTML</option> + <option value="mod_imagemap" translatable="no">mod_imagemap</option> + </param> <output> <extension>.map</extension> <mimetype>text/plain</mimetype> - <filetypename>WWW Image Map</filetypename> + <filetypename>Web Image Map (*.map)</filetypename> <dataloss>true</dataloss> </output> - <param type="optiongroup" appearance="radio" name="maptype" gui-text="Map Type"> - <option value="HTML">HTML</option> - <option value="XHTML">XHTML</option> - <option value="mod_imagemap">mod_imagemap</option> - </param> <script> <command location="inx" interpreter="python">imagemap.py</command> </script> diff --git a/imagemap.py b/imagemap.py index 9a6b9c7..00b5f64 100644 --- a/imagemap.py +++ b/imagemap.py @@ -1,8 +1,10 @@ +import gettext import inkex from inkex import bezier from inkex.command import inkscape_command -from inkex.localization import inkex_gettext as _ +from inkex.localization import inkex_gettext as _i from lxml.builder import E +_ = gettext.translation('imagemap','locale',fallback=True).gettext # (X)HTML stuff: ESCAPE=str.maketrans({'&':'&','<':'<','>':'>'}) @@ -86,7 +88,7 @@ class ImageMap(inkex.OutputExtension): rects+=[newid] if len(links)==0: - raise inkex.AbortExtension(_("Image has no hyperlinks.\nAdd a hyperlink to an object with right-click → \"{}\".").format(_("Create Anchor (Hyperlink)"))) + raise inkex.AbortExtension(_("Image has no hyperlinks.\nAdd a hyperlink to an object with right-click → \"{}\".").format(_i("Create Anchor (Hyperlink)"))) command=\ ''.join(f'select-clear;select-by-id:{i};selection-ungroup;' for i in reversed(svgIDs)) \ +''.join(f'select-clear;select-by-selector:[style~="{CSS_LINK_INDEX}-{i}"];object-stroke-to-path;selection-ungroup;path-union;select-by-id:{rects[i]};path-intersection;object-set-attribute:style,{CSS_LINK_INDEX}:" {CSS_LINK_INDEX}-{i} ";' for i in range(len(links))) \ |
