From 09a4bfac066ae57c1609bf1e944d66d89a133550 Mon Sep 17 00:00:00 2001 From: Christian Metzen Date: Mon, 9 Jan 2012 16:04:02 +0100 Subject: [PATCH] i18n for plater.py, including german translation --- locale/de/LC_MESSAGES/plater.mo | Bin 0 -> 1551 bytes locale/de/LC_MESSAGES/plater.po | 89 ++++++++++++++++++++++++++++++ locale/plater.pot | 93 ++++++++++++++++++++++++++++++++ plater.py | 47 +++++++++------- 4 files changed, 210 insertions(+), 19 deletions(-) create mode 100644 locale/de/LC_MESSAGES/plater.mo create mode 100644 locale/de/LC_MESSAGES/plater.po create mode 100644 locale/plater.pot diff --git a/locale/de/LC_MESSAGES/plater.mo b/locale/de/LC_MESSAGES/plater.mo new file mode 100644 index 0000000000000000000000000000000000000000..902c7cd22d37584946a44da9bb48440fabae84b1 GIT binary patch literal 1551 zcmZvazjGT!6vr152#6nn1kw=TxnUg03CS}IMoOG0lEMUJB5VN(!wj>!dzO~0cQt!^ zwv|cA&`{G*QSb*)FjRC-Lk9&jRQwAx)EU0-e2H-4o!kA~d;8;k_wD=p)bZ~W+DqtX z(SJpM75$6HFrfVoegOUf9tY1puGBN&5_kqoz$d{T_yqVNcoO`$@@r7`O)Go5vLpB+ z{BuxZe+!-le*k6w&y{@_Y{C8ud=5N)>>%C}*oLNM@JskJ1d%v*F^In3z}LV(!KcB0 z!Kc7`;Pc=Kh!y(`DEeOqW#1bhKDC136>t@le2hTR7b<=Oz6|?&a1H#a^8W+MImd8l zl|oobokABK&x%nsxi_w*a0T@Oy5ysVE)6nE9i@Rmw2IFAO>!Z5I)N_t5p5Dzbpq4e z7nB#(&#rcnqNmid4iu+MlVGw-)UlQdm+KwQD4l9I;hc62oMR^I^H^7%BKmTeSsjg= zs4G~yRakqTav#E+aucYvth(BzY*kkR9E^)Fs>hZitDbkP`g=1Uq8fOesi8@4(U!3+ z+Uz49(S;c`L};dQVQdBk@OZ0+MI;@m*=U@XL2Zr(kAjd925PG_0C5(Yw8NFL>Wrbq*D%*={y$`qzxnhF3TKnSt-9f zmZiz4O;lvL1IlUtYnO2lpQ8y+G461%9=ndH(;iOlg(AH*<`_w$?|5sMXj7^d>&N53 zkmA%}|ChY{Ii%y#!he-RG?S`ujfhkOonicJ|Hmn6H#1DP3$o(NnB?`%LvsgrSj-+( z(Vb%JK{*p%1211zaCsi?dbqA1@jhJHhZY>F?Y?nAQtn72\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: German\n" +"X-Poedit-Country: GERMANY\n" + +#: plater.py:223 +msgid "Plate building tool" +msgstr "Plate building tool" + +#: plater.py:229 +msgid "Clear" +msgstr "Löschen" + +#: plater.py:230 +msgid "Load" +msgstr "Laden" + +#: plater.py:232 +msgid "Export" +msgstr "Exportieren" + +#: plater.py:235 +msgid "Done" +msgstr "Fertig" + +#: plater.py:237 +msgid "Cancel" +msgstr "Abbrechen" + +#: plater.py:239 +msgid "Snap to Z = 0" +msgstr "Einrasten auf Z = 0" + +#: plater.py:240 +msgid "Put at 100, 100" +msgstr "Auf 100, 100 setzen" + +#: plater.py:241 +msgid "Delete" +msgstr "Löschen" + +#: plater.py:242 +msgid "Auto" +msgstr "Auto" + +#: plater.py:266 +msgid "Autoplating" +msgstr "Autoplating" + +#: plater.py:294 +msgid "Bed full, sorry sir :(" +msgstr "Das Druckbett ist voll! Sorry." + +#: plater.py:304 +msgid "Are you sure you want to clear the grid? All unsaved changes will be lost." +msgstr "Bist du sicher dass du das Raster leeren willst? Alle ungesicherten Änderungen gehen verloren." + +#: plater.py:304 +msgid "Clear the grid?" +msgstr "Raster leeren?" + +#: plater.py:346 +msgid "Pick file to save to" +msgstr "Wähle die zu sichernde Datei" + +#: plater.py:347 +msgid "STL files (;*.stl;)" +msgstr "STL Dateien (;*.stl;)" + +#: plater.py:367 +msgid "wrote " +msgstr "geschrieben" + +#: plater.py:370 +msgid "Pick file to load" +msgstr "Wähle die zu ladende Datei" + +#: plater.py:371 +msgid "STL files (;*.stl;)|*.stl|OpenSCAD files (;*.scad;)|*.scad" +msgstr "STL Dateien (;*.stl;)|*.stl|OpenSCAD Dateien (;*.scad;)|*.scad" + diff --git a/locale/plater.pot b/locale/plater.pot new file mode 100644 index 0000000..c4daabd --- /dev/null +++ b/locale/plater.pot @@ -0,0 +1,93 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2012-01-09 15:07+CET\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: plater.py:223 +msgid "Plate building tool" +msgstr "" + +#: plater.py:229 +msgid "Clear" +msgstr "" + +#: plater.py:230 +msgid "Load" +msgstr "" + +#: plater.py:232 +msgid "Export" +msgstr "" + +#: plater.py:235 +msgid "Done" +msgstr "" + +#: plater.py:237 +msgid "Cancel" +msgstr "" + +#: plater.py:239 +msgid "Snap to Z = 0" +msgstr "" + +#: plater.py:240 +msgid "Put at 100, 100" +msgstr "" + +#: plater.py:241 +msgid "Delete" +msgstr "" + +#: plater.py:242 +msgid "Auto" +msgstr "" + +#: plater.py:266 +msgid "Autoplating" +msgstr "" + +#: plater.py:294 +msgid "Bed full, sorry sir :(" +msgstr "" + +#: plater.py:304 +msgid "Are you sure you want to clear the grid? All unsaved changes will be lost." +msgstr "" + +#: plater.py:304 +msgid "Clear the grid?" +msgstr "" + +#: plater.py:346 +msgid "Pick file to save to" +msgstr "" + +#: plater.py:347 +msgid "STL files (;*.stl;)" +msgstr "" + +#: plater.py:367 +msgid "wrote " +msgstr "" + +#: plater.py:370 +msgid "Pick file to load" +msgstr "" + +#: plater.py:371 +msgid "STL files (;*.stl;)|*.stl|OpenSCAD files (;*.scad;)|*.scad" +msgstr "" + diff --git a/plater.py b/plater.py index c1f6af8..a6b7eb6 100755 --- a/plater.py +++ b/plater.py @@ -1,9 +1,18 @@ #!/usr/bin/env python + +# Set up Internationalization using gettext +# searching for installed locales on /usr/share; uses relative folder if not found (windows) +import os, gettext, Queue, re + +if os.path.exists('/usr/share/pronterface/locale'): + gettext.install('plater', '/usr/share/pronterface/locale', unicode=1) +else: + gettext.install('plater', './locale', unicode=1) + import wx import time import random import threading -import os import math import sys @@ -220,26 +229,26 @@ class showstl(wx.Window): class stlwin(wx.Frame): def __init__(self, size=(800, 580), callback=None, parent=None): - wx.Frame.__init__(self, parent, title="Plate building tool", size=size) + wx.Frame.__init__(self, parent, title=_("Plate building tool"), size=size) self.SetIcon(wx.Icon("plater.ico", wx.BITMAP_TYPE_ICO)) self.mainsizer = wx.BoxSizer(wx.HORIZONTAL) self.panel = wx.Panel(self, -1, size=(150, 600), pos=(0, 0)) self.panel.SetBackgroundColour((10, 10, 10)) self.l = wx.ListBox(self.panel, size=(300, 180), pos=(0, 30)) - self.cl = wx.Button(self.panel, label="Clear", pos=(0, 205)) - self.lb = wx.Button(self.panel, label="Load", pos=(0, 0)) + self.cl = wx.Button(self.panel, label=_("Clear"), pos=(0, 205)) + self.lb = wx.Button(self.panel, label=_("Load"), pos=(0, 0)) if(callback is None): - self.eb = wx.Button(self.panel, label="Export", pos=(100, 0)) + self.eb = wx.Button(self.panel, label=_("Export"), pos=(100, 0)) self.eb.Bind(wx.EVT_BUTTON, self.export) else: - self.eb = wx.Button(self.panel, label="Done", pos=(100, 0)) + self.eb = wx.Button(self.panel, label=_("Done"), pos=(100, 0)) self.eb.Bind(wx.EVT_BUTTON, lambda e: self.done(e, callback)) - self.eb = wx.Button(self.panel, label="Cancel", pos=(200, 0)) + self.eb = wx.Button(self.panel, label=_("Cancel"), pos=(200, 0)) self.eb.Bind(wx.EVT_BUTTON, lambda e: self.Destroy()) - self.sb = wx.Button(self.panel, label="Snap to Z = 0", pos=(00, 255)) - self.cb = wx.Button(self.panel, label="Put at 100, 100", pos=(0, 280)) - self.db = wx.Button(self.panel, label="Delete", pos=(0, 305)) - self.ab = wx.Button(self.panel, label="Auto", pos=(0, 330)) + self.sb = wx.Button(self.panel, label=_("Snap to Z = 0"), pos=(00, 255)) + self.cb = wx.Button(self.panel, label=_("Put at 100, 100"), pos=(0, 280)) + self.db = wx.Button(self.panel, label=_("Delete"), pos=(0, 305)) + self.ab = wx.Button(self.panel, label=_("Auto"), pos=(0, 330)) self.cl.Bind(wx.EVT_BUTTON, self.clear) self.lb.Bind(wx.EVT_BUTTON, self.right) self.sb.Bind(wx.EVT_BUTTON, self.snap) @@ -263,7 +272,7 @@ class stlwin(wx.Frame): #self.SetClientSize(size) def autoplate(self, event): - print "Autoplating" + print _("Autoplating") separation = 2 bedsize = [200, 200, 100] cursor = [0, 0, 0] @@ -291,7 +300,7 @@ class stlwin(wx.Frame): max[1] = cursor[1] + x cursor[0] += x + separation if (cursor[1] + y) >= bedsize[1]: - print "Bed full, sorry sir :(" + print _("Bed full, sorry sir :(") self.Refresh() return centreoffset = [(bedsize[0] - max[0]) / 2, (bedsize[1] - max[1]) / 2] @@ -301,7 +310,7 @@ class stlwin(wx.Frame): self.Refresh() def clear(self, event): - result = wx.MessageBox('Are you sure you want to clear the grid? All unsaved changes will be lost.', 'Clear the grid?', + result = wx.MessageBox(_('Are you sure you want to clear the grid? All unsaved changes will be lost.'), _('Clear the grid?'), wx.YES_NO | wx.ICON_QUESTION) if (result == 2): self.models = {} @@ -343,8 +352,8 @@ class stlwin(wx.Frame): self.Destroy() def export(self, event): - dlg = wx.FileDialog(self, "Pick file to save to", self.basedir, style=wx.FD_SAVE) - dlg.SetWildcard("STL files (;*.stl;)") + dlg = wx.FileDialog(self, _("Pick file to save to"), self.basedir, style=wx.FD_SAVE) + dlg.SetWildcard(_("STL files (;*.stl;)")) if(dlg.ShowModal() == wx.ID_OK): name = dlg.GetPath() self.writefiles(name) @@ -364,11 +373,11 @@ class stlwin(wx.Frame): facets += i.facets sf.close() stltool.emitstl(name, facets, "plater_export") - print "wrote ", name + print _("wrote "), name def right(self, event): - dlg = wx.FileDialog(self, "Pick file to load", self.basedir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) - dlg.SetWildcard("STL files (;*.stl;)|*.stl|OpenSCAD files (;*.scad;)|*.scad") + dlg = wx.FileDialog(self, _("Pick file to load"), self.basedir, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) + dlg.SetWildcard(_("STL files (;*.stl;)|*.stl|OpenSCAD files (;*.scad;)|*.scad")) if(dlg.ShowModal() == wx.ID_OK): name = dlg.GetPath() if (name.lower().endswith(".stl")):