Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar3/activity/i18n.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar3/activity/i18n.py')
-rw-r--r--src/sugar3/activity/i18n.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sugar3/activity/i18n.py b/src/sugar3/activity/i18n.py
index 8b8e663..fe0d968 100644
--- a/src/sugar3/activity/i18n.py
+++ b/src/sugar3/activity/i18n.py
@@ -119,7 +119,8 @@ def get_locale_path(bundle_id):
@type bundle_id: string
@param bundle_id: The bundle id of the activity in question
@rtype: string
- @return: the preferred locale path
+ @return: the preferred locale path or None in the
+ case of an error
"""
# Note: We pre-assign weights to the directories so that if no translations
@@ -135,10 +136,14 @@ def get_locale_path(bundle_id):
candidate_dirs[os.path.join(sys.prefix, 'share', 'locale')] = 0
+ default_locale = locale.getdefaultlocale()[0]
+ if not default_locale:
+ return None
+
for candidate_dir in candidate_dirs.keys():
if os.path.exists(candidate_dir):
full_path = os.path.join(candidate_dir, \
- locale.getdefaultlocale()[0], 'LC_MESSAGES', \
+ default_locale, 'LC_MESSAGES', \
bundle_id + '.mo')
if os.path.exists(full_path):
try: