Example #1
0
    languages = [ui_language, locale_lang]
    gettext.translation('virtaal', languages=languages, fallback=True).install(unicode=1)
else:
    fix_locale()
    try:
        #if the locale is not installed it can cause a traceback
        locale.setlocale(locale.LC_ALL, '')
        gettext.install("virtaal", unicode=1)
    except locale.Error, e:
        import logging
        logging.warning("Couldn't set the locale: %s", e)
        # See bug 3109
        __builtin__.__dict__['_'] = lambda s: s

if os.name =='nt' and getattr(sys, 'frozen', False) :
    fix_libintl()

if _(''):
    # If this is true, we have a translated interface
    ui_language = ui_language or get_locale_lang()
else:
    ui_language = 'en'


# Determine the directory the main executable is running from
main_dir = u''
if getattr(sys, 'frozen', False):
    main_dir = os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding()))
else:
    main_dir = os.path.dirname(unicode(sys.argv[0], sys.getfilesystemencoding()))
Example #2
0
        import logging
        logging.warning("Couldn't set the locale: %s", e)
        # See bug 3109
        __builtin__.__dict__['_'] = lambda s: s

# Determine the directory the main executable is running from
main_dir = u''
if getattr(sys, 'frozen', False):
    main_dir = os.path.dirname(
        unicode(sys.executable, sys.getfilesystemencoding()))
else:
    main_dir = os.path.dirname(
        unicode(sys.argv[0], sys.getfilesystemencoding()))

if os.name == 'nt' and getattr(sys, 'frozen', False):
    fix_libintl(main_dir)

if _(''):
    # If this is true, we have a translated interface
    ui_language = ui_language or get_locale_lang()
else:
    ui_language = 'en'


def get_abs_data_filename(path_parts, basedirs=None):
    """Get the absolute path to the given file- or directory name in Virtaal's
        data directory.

        @type  path_parts: list
        @param path_parts: The path parts that can be joined by os.path.join().
        """
Example #3
0
        import logging
        logging.warning("Couldn't set the locale: %s", e)
        # See bug 3109
        __builtin__.__dict__['_'] = lambda s: s


# Determine the directory the main executable is running from
main_dir = u''
if getattr(sys, 'frozen', False):
    main_dir = os.path.dirname(unicode(sys.executable, sys.getfilesystemencoding()))
else:
    main_dir = os.path.dirname(unicode(sys.argv[0], sys.getfilesystemencoding()))


if os.name =='nt' and getattr(sys, 'frozen', False):
    fix_libintl(main_dir)

if _(''):
    # If this is true, we have a translated interface
    ui_language = ui_language or get_locale_lang()
else:
    ui_language = 'en'


def get_abs_data_filename(path_parts, basedirs=None):
    """Get the absolute path to the given file- or directory name in Virtaal's
        data directory.

        @type  path_parts: list
        @param path_parts: The path parts that can be joined by os.path.join().
        """