[game-data-packager] 01/01: language autodetection: make it simpler
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Sun Nov 1 20:24:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
detiste-guest pushed a commit to branch master
in repository game-data-packager.
commit 66d5702760b6a0faeb662ab0d079cb64ab8363ef
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Sun Nov 1 21:17:50 2015 +0100
language autodetection: make it simpler
user without any English defined in $LANGUAGE or $LANG
will still end up with both en_US & en_GB packages as
both have same lang_score().
"en_AU", "en_IE" users will also end up with both en_US & en_GB versions;
maybe it's commonly accepted that they would prefer the en_GB over the en_US, see:
https://github.com/systemd/systemd/blob/master/src/locale/language-fallback-map
en_AU en_AU:en_GB
en_IE en_IE:en_GB
en_NZ en_NZ:en_GB
en_ZA en_ZA:en_GB
---
game_data_packager/util.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/game_data_packager/util.py b/game_data_packager/util.py
index 7d39704..3b2e33b 100644
--- a/game_data_packager/util.py
+++ b/game_data_packager/util.py
@@ -191,12 +191,9 @@ def lang_score(lang):
if lang in langs:
return len(langs) - langs.index(lang)
- for l in langs:
- if l == lang[0:2]:
- score = len(langs) - langs.index(l)
- if score > 1:
- score -= 1
- return score
+ lang = lang[0:2]
+ if lang in langs:
+ return len(langs) - langs.index(lang)
return 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list