split out translation support into an separate file so it can be more correctly included everywhere

This commit is contained in:
Chris Jones 2009-05-07 01:44:42 +01:00
parent 841fa18c58
commit b0302e6fab
9 changed files with 62 additions and 10 deletions

View File

@ -22,18 +22,9 @@
import os, sys import os, sys
from optparse import OptionParser, SUPPRESS_HELP from optparse import OptionParser, SUPPRESS_HELP
import terminatorlib.translation
from terminatorlib.version import APP_NAME, APP_VERSION from terminatorlib.version import APP_NAME, APP_VERSION
try:
import gettext
gettext.install (APP_NAME)
except ImportError:
import __builtin__
def dummytrans (text):
"""A _ function for systems without gettext. Effectively a NOOP"""
return text
__builtin__.__dict__['_'] = dummytrans
from terminatorlib.config import dbg, err, debug from terminatorlib.config import dbg, err, debug
import terminatorlib.config import terminatorlib.config

View File

@ -0,0 +1,19 @@
#!/usr/bin/python
# Terminator - multiple gnome terminals in one window
# Copyright (C) 2006-2008 cmsj@tenshu.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""Terminator by Chris Jones <cmsj@tenshu.net>"""

View File

@ -40,6 +40,8 @@ try:
except ImportError: except ImportError:
gconf = None gconf = None
from terminatorlib import translation
# set this to true to enable debugging output # set this to true to enable debugging output
# These should be moved somewhere better. # These should be moved somewhere better.
debug = False debug = False

View File

@ -2,6 +2,7 @@
import re import re
from terminatorlib.config import dbg, debug from terminatorlib.config import dbg, debug
from terminatorlib import translation
def group(*choices): return '(' + '|'.join(choices) + ')' def group(*choices): return '(' + '|'.join(choices) + ')'
def any(*choices): return group(*choices) + '*' def any(*choices): return group(*choices) + '*'

View File

@ -23,6 +23,8 @@ This list is taken from gnome-terminal's src/encoding.h
and src/encoding.c and src/encoding.c
""" """
from terminatorlib import translation
class TerminatorEncoding: class TerminatorEncoding:
"""Class to store encoding details""" """Class to store encoding details"""
encodings = [ encodings = [

View File

@ -3,6 +3,7 @@
from terminatorlib.config import dbg,err,Defaults,TerminatorConfValuestoreRC from terminatorlib.config import dbg,err,Defaults,TerminatorConfValuestoreRC
from terminatorlib.keybindings import TerminatorKeybindings,Modifier from terminatorlib.keybindings import TerminatorKeybindings,Modifier
from terminatorlib.version import APP_NAME, APP_VERSION from terminatorlib.version import APP_NAME, APP_VERSION
from terminatorlib import translation
import gtk, gobject import gtk, gobject

View File

@ -30,6 +30,7 @@ from config import dbg, err, debug
from terminatorlib.keybindings import TerminatorKeybindings from terminatorlib.keybindings import TerminatorKeybindings
from terminatorlib.terminatorterm import TerminatorTerm from terminatorlib.terminatorterm import TerminatorTerm
from terminatorlib.prefs_profile import ProfileEditor from terminatorlib.prefs_profile import ProfileEditor
from terminatorlib import translation
try: try:
import deskbar.core.keybinder as bindkey import deskbar.core.keybinder as bindkey

View File

@ -31,6 +31,9 @@ from terminatorlib.config import dbg, err, debug
#import encoding list #import encoding list
from terminatorlib.encoding import TerminatorEncoding from terminatorlib.encoding import TerminatorEncoding
# import translation support
from terminatorlib import translation
# import vte-bindings # import vte-bindings
try: try:
import vte import vte

View File

@ -0,0 +1,32 @@
#!/usr/bin/python
# Terminator - multiple gnome terminals in one window
# Copyright (C) 2006-2008 cmsj@tenshu.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 2 only.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
from terminatorlib.version import APP_NAME
try:
import gettext
gettext.install (APP_NAME)
except ImportError:
print "Using fallback _()"
import __builtin__
def dummytrans (text):
"""A _ function for systems without gettext. Effectively a NOOP"""
return text
__builtin__.__dict__['_'] = dummytrans