Add gettext support
This commit is contained in:
parent
f3c2433c29
commit
832c0ac988
|
@ -0,0 +1,60 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2007-12-29 02:52+0000\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: terminator:307
|
||||||
|
msgid "_Open Link"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:308
|
||||||
|
msgid "_Copy Link Address"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:314
|
||||||
|
msgid "_Send Mail To..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:315
|
||||||
|
msgid "_Copy Email Address"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:340
|
||||||
|
msgid "Show scrollbar"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:348
|
||||||
|
msgid "Split _Horizontally"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:352
|
||||||
|
msgid "Split _Vertically"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:414
|
||||||
|
msgid "Close?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:419
|
||||||
|
msgid "<big><b>Close all terminals?</b></big>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: terminator:422
|
||||||
|
#, python-format
|
||||||
|
msgid ""
|
||||||
|
"This window has %s terminals open. Closing the window will also close all "
|
||||||
|
"terminals."
|
||||||
|
msgstr ""
|
42
setup.py
42
setup.py
|
@ -1,6 +1,47 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
from distutils.command.install_data import install_data
|
||||||
|
from distutils.dep_util import newer
|
||||||
|
from distutils.log import info
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class InstallData(install_data):
|
||||||
|
def run (self):
|
||||||
|
self.data_files.extend (self._compile_po_files ())
|
||||||
|
install_data.run (self)
|
||||||
|
|
||||||
|
def _compile_po_files (self):
|
||||||
|
data_files = []
|
||||||
|
|
||||||
|
# Don't install language files on win32
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
return data_files
|
||||||
|
|
||||||
|
PO_DIR = 'po'
|
||||||
|
for po in glob.glob (os.path.join (PO_DIR,'*.po')):
|
||||||
|
lang = os.path.basename(po[:-3])
|
||||||
|
mo = os.path.join('build', 'mo', lang, 'terminator.mo')
|
||||||
|
|
||||||
|
directory = os.path.dirname(mo)
|
||||||
|
if not os.path.exists(directory):
|
||||||
|
info('creating %s' % directory)
|
||||||
|
os.makedirs(directory)
|
||||||
|
|
||||||
|
if newer(po, mo):
|
||||||
|
# True if mo doesn't exist
|
||||||
|
cmd = 'msgfmt -o %s %s' % (mo, po)
|
||||||
|
info('compiling %s -> %s' % (po, mo))
|
||||||
|
if os.system(cmd) != 0:
|
||||||
|
raise SystemExit('Error while running msgfmt')
|
||||||
|
|
||||||
|
dest = os.path.dirname(os.path.join('share', 'locale', lang, 'LC_MESSAGES', 'terminator.mo'))
|
||||||
|
data_files.append((dest, [mo]))
|
||||||
|
|
||||||
|
return data_files
|
||||||
|
|
||||||
|
|
||||||
setup(name='Terminator',
|
setup(name='Terminator',
|
||||||
version='0.6',
|
version='0.6',
|
||||||
|
@ -13,5 +54,6 @@ setup(name='Terminator',
|
||||||
data_files=[
|
data_files=[
|
||||||
('share/applications', ['terminator.desktop']),
|
('share/applications', ['terminator.desktop']),
|
||||||
],
|
],
|
||||||
|
cmdclass={'install_data': InstallData}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
23
terminator
23
terminator
|
@ -42,6 +42,7 @@ import gnome
|
||||||
import time
|
import time
|
||||||
import getopt
|
import getopt
|
||||||
import math
|
import math
|
||||||
|
import gettext
|
||||||
|
|
||||||
class TerminatorTerm:
|
class TerminatorTerm:
|
||||||
|
|
||||||
|
@ -303,15 +304,15 @@ class TerminatorTerm:
|
||||||
if url:
|
if url:
|
||||||
if url[1] != self.matches['email']:
|
if url[1] != self.matches['email']:
|
||||||
address = url[0]
|
address = url[0]
|
||||||
nameopen = "_Open Link"
|
nameopen = _("_Open Link")
|
||||||
namecopy = "_Copy Link Address"
|
namecopy = _("_Copy Link Address")
|
||||||
else:
|
else:
|
||||||
if url[0][0:7] != "mailto:":
|
if url[0][0:7] != "mailto:":
|
||||||
address = "mailto:" + url[0]
|
address = "mailto:" + url[0]
|
||||||
else:
|
else:
|
||||||
address = url[0]
|
address = url[0]
|
||||||
nameopen = "_Send Mail To..."
|
nameopen = _("_Send Mail To...")
|
||||||
namecopy = "_Copy Email Address"
|
namecopy = _("_Copy Email Address")
|
||||||
|
|
||||||
item = gtk.MenuItem (nameopen)
|
item = gtk.MenuItem (nameopen)
|
||||||
item.connect ("activate", lambda menu_item: gnome.url_show (address))
|
item.connect ("activate", lambda menu_item: gnome.url_show (address))
|
||||||
|
@ -336,7 +337,7 @@ class TerminatorTerm:
|
||||||
item = gtk.MenuItem ()
|
item = gtk.MenuItem ()
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
item = gtk.CheckMenuItem ("Show scrollbar")
|
item = gtk.CheckMenuItem (_("Show scrollbar"))
|
||||||
item.set_active (self._scrollbar.get_property ('visible'))
|
item.set_active (self._scrollbar.get_property ('visible'))
|
||||||
item.connect ("toggled", lambda menu_item: self.do_scrollbar_toggle ())
|
item.connect ("toggled", lambda menu_item: self.do_scrollbar_toggle ())
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
@ -344,11 +345,11 @@ class TerminatorTerm:
|
||||||
item = gtk.MenuItem ()
|
item = gtk.MenuItem ()
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
item = gtk.MenuItem ("Split _Horizontally")
|
item = gtk.MenuItem (_("Split _Horizontally"))
|
||||||
item.connect ("activate", lambda menu_item: self.term.splitaxis (self, False))
|
item.connect ("activate", lambda menu_item: self.term.splitaxis (self, False))
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
item = gtk.MenuItem ("Split _Vertically")
|
item = gtk.MenuItem (_("Split _Vertically"))
|
||||||
item.connect ("activate", lambda menu_item: self.term.splitaxis (self, True))
|
item.connect ("activate", lambda menu_item: self.term.splitaxis (self, True))
|
||||||
menu.append (item)
|
menu.append (item)
|
||||||
|
|
||||||
|
@ -410,16 +411,15 @@ class Terminator:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# show dialog
|
# show dialog
|
||||||
dialog = gtk.Dialog ("Close?", window, gtk.DIALOG_MODAL,
|
dialog = gtk.Dialog (_("Close?"), window, gtk.DIALOG_MODAL,
|
||||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
|
||||||
dialog.set_has_separator (False)
|
dialog.set_has_separator (False)
|
||||||
dialog.set_resizable (False)
|
dialog.set_resizable (False)
|
||||||
|
|
||||||
primairy = gtk.Label ('<big><b>Close all terminals?</b></big>')
|
primairy = gtk.Label (_('<big><b>Close all terminals?</b></big>'))
|
||||||
primairy.set_use_markup (True)
|
primairy.set_use_markup (True)
|
||||||
primairy.set_alignment (0, 0.5)
|
primairy.set_alignment (0, 0.5)
|
||||||
secundairy = gtk.Label (("This window has %s terminals open. " % len(self.term_list)) +
|
secundairy = gtk.Label (_("This window has %s terminals open. Closing the window will also close all terminals.") % len(self.term_list))
|
||||||
"Closing the window will also close all terminals.")
|
|
||||||
secundairy.set_line_wrap(True)
|
secundairy.set_line_wrap(True)
|
||||||
primairy.set_alignment (0, 0.5)
|
primairy.set_alignment (0, 0.5)
|
||||||
|
|
||||||
|
@ -620,6 +620,7 @@ if __name__ == '__main__':
|
||||||
if opt in ("-p", "--profile"):
|
if opt in ("-p", "--profile"):
|
||||||
profile = arg
|
profile = arg
|
||||||
|
|
||||||
|
gettext.install ('terminator')
|
||||||
term = Terminator (profile)
|
term = Terminator (profile)
|
||||||
|
|
||||||
# Set the Terminator in fullscreen state or maximize it.
|
# Set the Terminator in fullscreen state or maximize it.
|
||||||
|
|
Loading…
Reference in New Issue