diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2012-07-12 18:04:41 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2012-07-12 18:04:41 +0000 |
| commit | 98b79d5d99f334780027d4e3206e29a4e3f2370f (patch) | |
| tree | 97dcc76bf39f157a12200830e7932b45284c079e | |
| parent | Fix for 378413 : Show/Hide all layers (diff) | |
| download | inkscape-98b79d5d99f334780027d4e3206e29a4e3f2370f.tar.gz inkscape-98b79d5d99f334780027d4e3206e29a4e3f2370f.zip | |
Translations. Fix for Bug #425202 (Script messages not translated).
(bzr r11546)
| -rwxr-xr-x | share/extensions/inkex.py | 25 | ||||
| -rw-r--r-- | src/extension/implementation/script.cpp | 8 |
2 files changed, 19 insertions, 14 deletions
diff --git a/share/extensions/inkex.py b/share/extensions/inkex.py index 52b048dc8..e55c78530 100755 --- a/share/extensions/inkex.py +++ b/share/extensions/inkex.py @@ -26,14 +26,25 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ -import sys, copy, optparse, random, re +import copy import gettext +import optparse +import os +import random +import re +import sys + from math import * -gettext.install('inkscape') -# _ = gettext.gettext -# gettext.bindtextdomain('inkscape', '/usr/share/locale') -# gettext.textdomain('inkscape') +if sys.platform.startswith('win'): + import locale + current_locale, encoding = locale.getdefaultlocale() + os.environ['LANG'] = current_locale + gettext= gettext.translation('inkscape', "C:\Program Files\Inkscape\locale", [current_locale]) +else: + gettext= gettext.translation('inkscape') + +_ = gettext.gettext #a dictionary of all of the xmlns prefixes in a standard inkscape doc NSS = { @@ -97,9 +108,9 @@ def errormsg(msg): inkex.errormsg(_("This extension requires two selected paths.")) """ if isinstance(msg, unicode): - sys.stderr.write((msg + "\n").encode("UTF-8")) + sys.stderr.write(_(msg).encode("UTF-8") + "\n") else: - sys.stderr.write((unicode(msg, "utf-8", errors='replace') + "\n").encode("UTF-8")) + sys.stderr.write((unicode(_(msg), "utf-8", errors='replace') + "\n").encode("UTF-8")) def check_inkbool(option, opt, value): if str(value).capitalize() == 'True': diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index 432b25bb9..b5052d222 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -861,13 +861,7 @@ void Script::checkStderr (const Glib::ustring &data, textview->set_wrap_mode(Gtk::WRAP_WORD); textview->show(); - // Remove the last character - char *errormsg = (char*) data.c_str(); - while (*errormsg != '\0') errormsg++; - errormsg -= 1; - *errormsg = '\0'; - - textview->get_buffer()->set_text(_(data.c_str())); + textview->get_buffer()->set_text(data.c_str()); Gtk::ScrolledWindow * scrollwindow = new Gtk::ScrolledWindow(); scrollwindow->add(*textview); |
