Made some changes to ensure compatibility in Python 2 with gettext.

The gettext.install() functions supplies a way to force it to return
unicode which helps with compatibility between Python 2 & 3. To make it
work properly when merging those returned string with strings in the
different modules of gitinspector we also had to do some changes to make
sure all string literals are in unicode.
This commit is contained in:
Adam Waldenberg 2013-06-25 16:37:18 +02:00
parent 9c0633f8ad
commit f20c3c1895
13 changed files with 20 additions and 5 deletions

View File

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
__comment_begining__ = {"java": "/*", "c": "/*", "cpp": "/*", "h": "/*", "hpp": "/*", "html": "<!--", "php": "/*",
"py": "\"\"\"", "glsl": "/*", "rb": "=begin", "js": "/*", "sql": "/*", "xml": "<!--"}

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
import terminal
import textwrap

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
import terminal
import textwrap
@ -44,7 +45,7 @@ def set_filtered(file_name):
return True
return False
__filtering_info_text__ = _("The following files were excluded from the statistics due to the"
__filtering_info_text__ = _("The following files were excluded from the statistics due to the "
"specified exclusion patterns")
class Filtering(Outputable):

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
import version
import base64
import basedir

View File

@ -19,6 +19,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
import localization
localization.init()

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from extensions import __default_extensions__
from format import __available_formats__
import sys

View File

@ -18,6 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
__since__ = ""
__until__ = ""

View File

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import gettext
import locale
import os
@ -38,4 +39,4 @@ def init():
except IOError:
translation = gettext.NullTranslations()
translation.install()
translation.install(True)

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
import interval
import os

View File

@ -18,17 +18,18 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
import format
class Outputable(object):
def output_html(self):
print(_("HTML output not yet supported in \"") + self.__class__.__name__ + "\".")
print(_("HTML output not yet supported in") + " \"" + self.__class__.__name__ + "\".")
def output_text(self):
print(_("Text output not yet supported in \"") + self.__class__.__name__ + "\".")
print(_("Text output not yet supported in") + " \"" + self.__class__.__name__ + "\".")
def output_xml(self):
print(_("XML output not yet supported in \"") + self.__class__.__name__ + "\".")
print(_("XML output not yet supported in") + " \"" + self.__class__.__name__ + "\".")
def output(outputable):
if format.get_selected() == "html":

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
import blame
import terminal

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
from outputable import Outputable
import datetime
import terminal

View File

@ -18,6 +18,7 @@
# along with gitinspector. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
from __future__ import unicode_literals
import localization
localization.init()