diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2019-05-14 10:05:35 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2019-05-20 21:02:13 +0100 |
commit | 1357ca7582249d7ba0495957bb363f40b57a45b6 (patch) | |
tree | 30eb1e13f640c0c5984fd1e35e751c6accb319aa /deluge/i18n/util.py | |
parent | 72d363968e865a6518456aed2cfa320f7198eb34 (diff) | |
download | deluge-1357ca7582249d7ba0495957bb363f40b57a45b6.tar.gz deluge-1357ca7582249d7ba0495957bb363f40b57a45b6.tar.bz2 deluge-1357ca7582249d7ba0495957bb363f40b57a45b6.zip |
[i18n] Ignore non-translation dirs in get_languages
The `__pycache__` dir was showing up in list of available languages so
ensure only those directories with languages are returned.
Diffstat (limited to 'deluge/i18n/util.py')
-rw-r--r-- | deluge/i18n/util.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/deluge/i18n/util.py b/deluge/i18n/util.py index a2f287645..eddd003aa 100644 --- a/deluge/i18n/util.py +++ b/deluge/i18n/util.py @@ -15,6 +15,7 @@ import locale import logging import os import sys +from glob import glob from six.moves import builtins @@ -36,9 +37,14 @@ def get_languages(): lang = [] translations_path = get_translations_path() + lc_messages_path = os.path.join('LC_MESSAGES', I18N_DOMAIN + '.mo') for root, dirs, files in os.walk(translations_path): # Get the dirs - lang_dirs = dirs + lang_dirs = [ + lang_dir + for lang_dir in dirs + if glob(os.path.join(translations_path, lang_dir, lc_messages_path)) + ] break else: return lang |