diff --git a/invesalius/i18n.py b/invesalius/i18n.py index 4d21b6a..1705f6a 100644 --- a/invesalius/i18n.py +++ b/invesalius/i18n.py @@ -1,61 +1,61 @@ -#!/usr/bin/env python -# -*- coding: UTF-8 -*- - -#-------------------------------------------------------------------------- -# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas -# Copyright: (C) 2001 Centro de Pesquisas Renato Archer -# Homepage: http://www.softwarepublico.gov.br -# Contact: invesalius@cti.gov.br -# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) -#-------------------------------------------------------------------------- -# Este programa e software livre; voce pode redistribui-lo e/ou -# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme -# publicada pela Free Software Foundation; de acordo com a versao 2 -# da Licenca. -# -# Este programa eh distribuido na expectativa de ser util, mas SEM -# QUALQUER GARANTIA; sem mesmo a garantia implicita de -# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM -# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais -# detalhes. -#-------------------------------------------------------------------------- - -import ConfigParser -import locale -import gettext -import os -import sys - -import utils as utl - -def GetLocales(): - """Return a dictionary which defines supported languages""" - d = utl.TwoWaysDictionary ({'zh_TW': u'中文', - 'en': u'English', - 'es': u'Español', - 'ko': u'조선어', - 'pt_BR': u'Português (Brasil)', - 'pt': u'Português (Portugal)', - 'fr':u'Français', - 'el_GR':u'Ελληνική', - 'it_IT':'Italiano', - 'de_DE': 'Deutsch'}) - return d - -def GetLocaleOS(): - """Return language of the operating system.""" - if sys.platform == 'darwin': - locale.setlocale(locale.LC_ALL, "") - return locale.getlocale()[0] +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +#-------------------------------------------------------------------------- +# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas +# Copyright: (C) 2001 Centro de Pesquisas Renato Archer +# Homepage: http://www.softwarepublico.gov.br +# Contact: invesalius@cti.gov.br +# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt) +#-------------------------------------------------------------------------- +# Este programa e software livre; voce pode redistribui-lo e/ou +# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme +# publicada pela Free Software Foundation; de acordo com a versao 2 +# da Licenca. +# +# Este programa eh distribuido na expectativa de ser util, mas SEM +# QUALQUER GARANTIA; sem mesmo a garantia implicita de +# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM +# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais +# detalhes. +#-------------------------------------------------------------------------- + +import ConfigParser +import locale +import gettext +import os +import sys + +import utils as utl + +def GetLocales(): + """Return a dictionary which defines supported languages""" + d = utl.TwoWaysDictionary ({'zh_TW': u'中文', + 'en': u'English', + 'es': u'Español', + 'ko': u'조선어', + 'pt_BR': u'Português (Brasil)', + 'pt': u'Português (Portugal)', + 'fr':u'Français', + 'el_GR':u'Ελληνική', + 'it_IT':'Italiano', + 'de_DE': 'Deutsch'}) + return d + +def GetLocaleOS(): + """Return language of the operating system.""" + if sys.platform == 'darwin': + locale.setlocale(locale.LC_ALL, "") + return locale.getlocale()[0] lc = locale.getdefaultlocale()[0] if lc: return lc return 'en' - -def InstallLanguage(language): - language_dir = os.path.abspath(os.path.join('..','locale')) - lang = gettext.translation('invesalius', language_dir,\ - languages=[language], codeset='utf8') - # Using unicode - lang.install(unicode=1) - return lang.ugettext + +def InstallLanguage(language): + language_dir = os.path.abspath(os.path.join('..','locale')) + lang = gettext.translation('invesalius', language_dir,\ + languages=[language], codeset='utf8') + # Using unicode + lang.install(unicode=1) + return lang.ugettext -- libgit2 0.21.2