comparison src/core/i18n.py @ 1018:e22e4cf86204

core (i18n): use logging system instead of print
author Goffi <goffi@goffi.org>
date Thu, 08 May 2014 19:11:47 +0200
parents 1fe00f0c9a91
children 069ad98b360d
comparison
equal deleted inserted replaced
1017:0ea97f483464 1018:e22e4cf86204
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 20
21 from sat.core.log import getLogger
22 log = getLogger(__name__)
23
21 try: 24 try:
22 25
23 import gettext 26 import gettext
24 27
25 _ = gettext.translation('sat', 'i18n', fallback=True).ugettext 28 _ = gettext.translation('sat', 'i18n', fallback=True).ugettext
30 _translators[lang] = gettext.translation('sat', languages=[lang], fallback=True) 33 _translators[lang] = gettext.translation('sat', languages=[lang], fallback=True)
31 _translators[lang].install(unicode=True) 34 _translators[lang].install(unicode=True)
32 35
33 except ImportError: 36 except ImportError:
34 37
35 print "WARNING: gettext support disabled" 38 log.warning("gettext support disabled")
36 _ = lambda msg: msg # Libervia doesn't support gettext 39 _ = lambda msg: msg # Libervia doesn't support gettext
37 def languageSwitch(lang=None): 40 def languageSwitch(lang=None):
38 pass 41 pass
39 42
40 43