diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-03-10 00:19:40 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-03-10 00:44:20 +0000 |
| commit | fb85d5e1be440be7e9ee75e1a41d49e37383688c (patch) | |
| tree | e7fc0935e74b6169c5277e8dc825d1d81115804f /src/file.cpp | |
| parent | Adjust load order of get_filename() function (diff) | |
| download | inkscape-fb85d5e1be440be7e9ee75e1a41d49e37383688c.tar.gz inkscape-fb85d5e1be440be7e9ee75e1a41d49e37383688c.zip | |
Save default template as "default.$lang.svg" if present
By default we want to save as "default.svg", so it works indepentent
from the UI language selected.
However if a localized default template like "default.de.svg" is
already present (i.e. manually created by the user), it will
override our custom template, so we need to overwrite it.
Second part of a fix for
https://gitlab.com/inkscape/inkscape/issues/103
Diffstat (limited to 'src/file.cpp')
| -rw-r--r-- | src/file.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/file.cpp b/src/file.cpp index cb672e690..b23ed2185 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -1008,8 +1008,7 @@ sp_file_save_template(Gtk::Window &parentWindow, Glib::ustring name, auto encodedName = Glib::uri_escape_string(name); encodedName.append(".svg"); - auto filename = Inkscape::IO::Resource::get_path_ustring(USER, TEMPLATES, - encodedName.c_str()); + auto filename = Inkscape::IO::Resource::get_path_ustring(USER, TEMPLATES, encodedName.c_str()); auto operation_confirmed = sp_ui_overwrite_file(filename.c_str()); @@ -1020,9 +1019,14 @@ sp_file_save_template(Gtk::Window &parentWindow, Glib::ustring name, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG); if (isDefault) { + // save as "default.svg" by default (so it works intependent of UI language)unless + // a localized template like "default.de.svg" is already present (which overrides "default.svg") + Glib::ustring default_svg_localized = Glib::ustring("default.") + _("en") + ".svg"; + filename = Inkscape::IO::Resource::get_path_ustring(USER, TEMPLATES, default_svg_localized.c_str()); - filename = Inkscape::IO::Resource::get_path_ustring(USER, - TEMPLATES, "default.svg"); + if (!Inkscape::IO::file_test(filename.c_str(), G_FILE_TEST_EXISTS)) { + filename = Inkscape::IO::Resource::get_path_ustring(USER, TEMPLATES, "default.svg"); + } file_save(parentWindow, document, filename, Inkscape::Extension::db.get(".svg"), false, false, |
