# HG changeset patch # User Neil Muller # Date 1359291033 -7200 # Node ID 5ec7905b23654be6aeddde585a5874ba2561f5bf # Parent cc284445181b8ac7b6552bbc4e2e6167872f4834 Don't use resource module to find module locale data diff -r cc284445181b -r 5ec7905b2365 pyntnclick/i18n.py --- a/pyntnclick/i18n.py Sun Jan 27 14:47:58 2013 +0200 +++ b/pyntnclick/i18n.py Sun Jan 27 14:50:33 2013 +0200 @@ -1,7 +1,13 @@ # internationalization from gettext import gettext +from pkg_resources import resource_filename def _(s): return unicode(gettext(s), "utf-8") + + +def get_module_locale(module): + """Get the locale data from within the module.""" + return resource_filename(module, 'locale') diff -r cc284445181b -r 5ec7905b2365 pyntnclick/main.py --- a/pyntnclick/main.py Sun Jan 27 14:47:58 2013 +0200 +++ b/pyntnclick/main.py Sun Jan 27 14:50:33 2013 +0200 @@ -12,7 +12,7 @@ import pygame from pygame.locals import SWSURFACE -from pyntnclick.i18n import _ +from pyntnclick.i18n import _, get_module_locale from pyntnclick.engine import Engine from pyntnclick.gamescreen import DefMenuScreen, DefEndScreen, GameScreen from pyntnclick.constants import GameConstants, DEBUG_ENVVAR @@ -169,8 +169,9 @@ if opts.scene is None: print 'Need to supply a scene to use the rect drawer' sys.exit(1) - gettext.bindtextdomain('pyntnclick_tools', - self.resource.get_resource_path('locale')) + gettext.bindtextdomain('pyntnclick-tools', + get_module_locale(self.resource.DEFAULT_RESOURCE_MODULE)) + gettext.textdomain('pyntnclick-tools') make_rect_display() try: self.engine = RectEngine(self, opts.detail)