Example #1
0
from rednotebook.external import elibintl

# We need to translate 3 different types of strings:
# * sourcecode strings
# * gtkbuilder strings
# * gtk stock names

LOCALE_PATH = filesystem.get_utf8_path(filesystem.locale_dir)

# the name of the gettext domain.
GETTEXT_DOMAIN = 'rednotebook'

# Register _() as a global translation function and set up the translation
try:
    elibintl.install(GETTEXT_DOMAIN, LOCALE_PATH)
except locale.Error, err:
    # unsupported locale setting
    logging.error('Locale could not be set: "%s"' % err)
    logging.error('Probably you have to install the appropriate language packs')
    # Make the _() function available even if gettext is not working.
    import __builtin__
    if not hasattr(__builtin__, '_'):
        __builtin__.__dict__['_'] = lambda s: s

## ------------------- end Enable i18n -------------------------------


from rednotebook.util import utils
from rednotebook.util import markup
from rednotebook import info
Example #2
0
1) works fine. For 3) we need a workaround in main_window.py. If we
initialize libintl with elibintl, the translations for 2) stop working.
Without the workaround we need to initalize libintl to avoid UTF-8
encoding errors.

When the problem is fixed upstream, we can pass libintl='libintl-8.dll'
to elibintl. See also

https://bugzilla.gnome.org/show_bug.cgi?id=574520
https://bugzilla.gnome.org/show_bug.cgi?id=753991
https://github.com/tobias47n9e/pygobject-locale
https://sourceforge.net/p/pygobjectwin32/tickets/27/

"""

elibintl.install(GETTEXT_DOMAIN, LOCALE_PATH, libintl=None)

# ------------------- end Enable i18n -------------------------------

from rednotebook.util import utils
from rednotebook.util import markup
from rednotebook import info
from rednotebook import configuration
from rednotebook import data

args = info.get_commandline_parser().parse_args()

# ---------------------- Enable logging -------------------------------


def setup_logging(log_file):
Example #3
0
1) works fine. For 3) we need a workaround in main_window.py. If we
initialize libintl with elibintl, the translations for 2) stop working.
Without the workaround we need to initalize libintl to avoid UTF-8
encoding errors.

When the problem is fixed upstream, we can pass libintl='libintl-8.dll'
to elibintl. See also

https://bugzilla.gnome.org/show_bug.cgi?id=574520
https://bugzilla.gnome.org/show_bug.cgi?id=753991
https://github.com/tobias47n9e/pygobject-locale
https://sourceforge.net/p/pygobjectwin32/tickets/27/

"""

elibintl.install(GETTEXT_DOMAIN, LOCALE_PATH, libintl=None)

# ------------------- end Enable i18n -------------------------------


from rednotebook.util import utils
from rednotebook.util import markup
from rednotebook import info
from rednotebook import configuration
from rednotebook import data


args = info.get_commandline_parser().parse_args()

# ---------------------- Enable logging -------------------------------