diff options
author | Pootle daemon <pootle@pootle.sugarlabs.org> | 2011-06-13 14:23:40 (GMT) |
---|---|---|
committer | Pootle daemon <pootle@pootle.sugarlabs.org> | 2011-06-13 14:23:40 (GMT) |
commit | 86e2111461fab98d8c188d50ec8bd0c72c527f73 (patch) | |
tree | 6976b1ce163cb60586011951d748177e3663e937 /TurtleArt/tagettext.py | |
parent | d0bcef61b8ca9b8ef0066a891819dba950764d40 (diff) | |
parent | c9b92a2a244430c677b2e27645a23c082c6c8188 (diff) |
Merge branch 'master' of git.sugarlabs.org:turtleart/mainline
Diffstat (limited to 'TurtleArt/tagettext.py')
-rw-r--r-- | TurtleArt/tagettext.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/TurtleArt/tagettext.py b/TurtleArt/tagettext.py new file mode 100644 index 0000000..ebeebb3 --- /dev/null +++ b/TurtleArt/tagettext.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2010-11 Walter Bender, Martin Langhoff +# License: GPLv2 + +# Defines the magic global _() with the right params so all modules +# can use it. +# +# Plugins that want to override MUST use a different technique. See +# the developer notes in the TA wikipage. +# +import gettext +import os + +# In a git checkout, locale is in the root of the project +# so one dir "up" from tagettext.py +localedir = os.path.join(os.path.dirname(os.path.dirname(__file__)), + 'locale' ) + +if os.path.exists(localedir): + # works from a git checkout + gettext.install('org.laptop.TurtleArtActivity', localedir) +else: + # fallback for packaged TA (rpm, xo) + gettext.install('org.laptop.TurtleArtActivity') |