From: Eugene Gagarin Date: Wed, 29 Apr 2009 09:57:55 +0000 (+0400) Subject: Added translation capability and russian translation X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=415fdcfa2f2b55d8647dac83558323e38823e561;p=findit Added translation capability and russian translation --- diff --git a/src/debs/search.py b/src/debs/search.py index 8b6d746..1cea7aa 100755 --- a/src/debs/search.py +++ b/src/debs/search.py @@ -93,9 +93,9 @@ class Gtk_Presentation(object): self.outtable_rbtn.set_name('outtable') outdiagram_rbtn = gtk.RadioButton(self.outtable_rbtn, 'Diagram') outdiagram_rbtn.set_name('outdiagram') - out1_rbtn = gtk.RadioButton(self.outtable_rbtn, 'Another 1') - out1_rbtn.set_name('outanother1') - out_rbtns = [self.outtable_rbtn, outdiagram_rbtn, out1_rbtn] + out2_rbtn = gtk.RadioButton(self.outtable_rbtn, 'Another 2') + out2_rbtn.set_name('outanother2') + out_rbtns = [self.outtable_rbtn, outdiagram_rbtn, out2_rbtn] hbox = gtk.HBox(False, 4) hbox.pack_start(qty_label, False, False, 0) diff --git a/src/files/outtable.py b/src/files/outtable.py index 9585470..9135445 100755 --- a/src/files/outtable.py +++ b/src/files/outtable.py @@ -46,14 +46,14 @@ class Gtk_Presentation(object): treeview = gtk.TreeView(self.liststore) # Создаем и настраиваем колонку с размером файла - size_col = gtk.TreeViewColumn( 'Size') + size_col = gtk.TreeViewColumn(_('Size')) cell1 = gtk.CellRendererText() cell1.set_property('width', 90) size_col.pack_start(cell1, True) size_col.add_attribute(cell1, 'text', 1) treeview.append_column(size_col) # Создаем и настраиваем колонку с именем файла - path_col = gtk.TreeViewColumn( 'Path') + path_col = gtk.TreeViewColumn(_('Path')) cell2 = gtk.CellRendererText() path_col.pack_start(cell2, True) path_col.add_attribute(cell2, 'text', 0) diff --git a/src/files/search.py b/src/files/search.py index 195d0f7..4816c90 100755 --- a/src/files/search.py +++ b/src/files/search.py @@ -67,6 +67,7 @@ class Abstraction(object): stopit = get_stopit() if stopit: stopit = False + print 'Stopped' raise StopIteration # Query only valid files try: @@ -117,7 +118,7 @@ class Gtk_Presentation(object): self.path_entry.set_text(self.config['start_path']) # "Files quantity" label - qty_label = gtk.Label('Files quantity') + qty_label = gtk.Label(_('Files quantity')) # "Files quantity" spin self.qty_spin = gtk.SpinButton() @@ -127,24 +128,22 @@ class Gtk_Presentation(object): self.qty_spin.set_value(self.config['count']) # "Start" button - self.start_btn = gtk.Button('Start') + self.start_btn = gtk.Button(_('Start')) self.start_btn.connect('released', self.start_btn_released, start_func) # "Stop" button - self.stop_btn = gtk.Button('Stop') + self.stop_btn = gtk.Button(_('Stop')) self.stop_btn.set_sensitive(False) self.stop_btn.connect('clicked', self.stop_btn_clicked) # Output selection - outtable_rbtn = gtk.RadioButton(None, 'Table') + outtable_rbtn = gtk.RadioButton(None, _('Table')) outtable_rbtn.set_name('outtable') - outdiagram_rbtn = gtk.RadioButton(outtable_rbtn, 'Diagram') + outdiagram_rbtn = gtk.RadioButton(outtable_rbtn, _('Diagram')) outdiagram_rbtn.set_name('outdiagram') out1_rbtn = gtk.RadioButton(outtable_rbtn, 'Another 1') out1_rbtn.set_name('outanother1') - out2_rbtn = gtk.RadioButton(outtable_rbtn, 'Another 2') - out2_rbtn.set_name('outanother2') - self.out_rbtns = [outtable_rbtn, outdiagram_rbtn, out1_rbtn, out2_rbtn] + self.out_rbtns = [outtable_rbtn, outdiagram_rbtn, out1_rbtn] hbox = gtk.HBox(False, 4) hbox.pack_start(qty_label, False, False, 0) diff --git a/src/main.py b/src/main.py index 07dfb9e..fb86578 100755 --- a/src/main.py +++ b/src/main.py @@ -39,6 +39,18 @@ under the terms of the GNU General Public License\nas published by the Free \ Software Foundation; either version 3\nof the License, or (at your option) \ any later version.' + import gettext + try: + # Meaning ru/LC_MESSAGES/program.mo in current dir (sys.path[0]) + # For /usr/share/locale uncomment next string: + #LANGRU = gettext.translation('findit') + LANGRU = gettext.translation('findit', sys.path[0], languages=['ru']) + LANGRU.install() + except IOError: + # Comment out before use pygettext + def _(text): + return text + #============================================================================== class Cli_Presentation(object): @@ -90,9 +102,9 @@ class Gtk_Presentation(object): def _create_menu(): """Create main menu.""" menubar = gtk.MenuBar() - fileitem = gtk.MenuItem( '_File' ) - viewitem = gtk.MenuItem( '_View' ) - helpitem = gtk.MenuItem( '_Help' ) + fileitem = gtk.MenuItem(_('_File')) + viewitem = gtk.MenuItem(_('_View')) + helpitem = gtk.MenuItem(_('_Help')) helpitem.connect('activate', about_dialog) menubar.add(fileitem) menubar.add(viewitem) @@ -108,8 +120,8 @@ class Gtk_Presentation(object): filesearch_tbtn.set_name('files') debsearch_tbtn.set_name('debs') - filesearch_tbtn.set_label('Files search') - debsearch_tbtn.set_label('Debs search') + filesearch_tbtn.set_label(_('Files search')) + debsearch_tbtn.set_label(_('Debs search')) filesearch_tbtn.connect('clicked', self.show_search_toplevel, 'files') debsearch_tbtn.connect('clicked', self.show_search_toplevel, 'debs') @@ -139,8 +151,8 @@ class Gtk_Presentation(object): dialog.destroy() window = gtk.Window() - window.set_default_size(560, 400) - window.set_geometry_hints(None, 560, 400) + window.set_default_size(600, 400) + window.set_geometry_hints(None, 600, 400) window.set_border_width(4) window.set_wmclass('MainWindow', 'FindIT') window.connect('destroy', gtk.main_quit) diff --git a/src/ru/LC_MESSAGES/findit.mo b/src/ru/LC_MESSAGES/findit.mo new file mode 100755 index 0000000..28e96a5 Binary files /dev/null and b/src/ru/LC_MESSAGES/findit.mo differ diff --git a/src/ru/LC_MESSAGES/findit.po b/src/ru/LC_MESSAGES/findit.po new file mode 100755 index 0000000..0f9275d --- /dev/null +++ b/src/ru/LC_MESSAGES/findit.po @@ -0,0 +1,65 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR ORGANIZATION +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2009-04-29 13:45+Russian Standard Time\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=UTF-8\n" +"Content-Transfer-Encoding: ENCODING\n" +"Generated-By: pygettext.py 1.5\n" + + +#: main.py:105 +msgid "_File" +msgstr "_Файл" + +#: main.py:106 +msgid "_View" +msgstr "_Вид" + +#: main.py:107 +msgid "_Help" +msgstr "_Справка" + +#: main.py:123 +msgid "Files search" +msgstr "Файлы" + +#: main.py:124 +msgid "Debs search" +msgstr "Debian пакеты" + +#: outtable.py:49 +msgid "Size" +msgstr "Размер" + +#: outtable.py:56 +msgid "Path" +msgstr "Путь" + +#: search.py:120 +msgid "Files quantity" +msgstr "Количество файлов" + +#: search.py:130 +msgid "Start" +msgstr "Старт" + +#: search.py:134 +msgid "Stop" +msgstr "Стоп" + +#: search.py:139 +msgid "Table" +msgstr "Таблица" + +#: search.py:141 +msgid "Diagram" +msgstr "Диаграмма" +