00001 # -*- coding: utf-8 -*- 00002 # smolt - Fedora hardware profiler 00003 # 00004 # Copyright (C) 2007 Mike McGrath 00005 # 00006 # This program is free software; you can redistribute it and/or modify 00007 # it under the terms of the GNU General Public License as published by 00008 # the Free Software Foundation; either version 2 of the License, or 00009 # (at your option) any later version. 00010 # 00011 # This program is distributed in the hope that it will be useful, 00012 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 # GNU General Public License for more details. 00015 # 00016 # You should have received a copy of the GNU General Public License 00017 # along with this program; if not, write to the Free Software 00018 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 import locale 00021 try: 00022 locale.setlocale(locale.LC_ALL, '') 00023 except locale.Error: 00024 locale.setlocale(locale.LC_ALL, 'C') 00025 #print locale.LC_ALL 00026 00027 import os 00028 import gettext 00029 00030 try: 00031 if os.path.isdir('po'): 00032 # if there is a local directory called 'po' use it so we can test 00033 # without installing 00034 #t = gettext.translation('smolt', 'po', fallback = True) 00035 t = gettext.translation('smolt', '/usr/share/locale/', fallback = True) 00036 else: 00037 t = gettext.translation('smolt', '/usr/share/locale/', fallback = True) 00038 except IndexError: 00039 locale.setlocale(locale.LC_ALL, 'C') 00040 t = gettext.translation('smolt', '/usr/share/locale/', fallback=True, languages='en_US') 00041 00042 _ = t.ugettext
1.6.3