-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Territory languages #315
Territory languages #315
Conversation
Current coverage is
|
0bb5afd
to
4d0de3d
Compare
Even though the population percents may be informative, I have the feeling that it will become outdated very quickly. Therefore, unless we can keep up with the bi-yearly CLDR release schedule, we may be left behind again (like when we supported CLDR 23) and, then, such data will not be very useful. On the other hand, the supported languages by territory will hopefully change in a less dramatic way. One solution could be to add a big fat disclaimer note regarding the possible lack of accuracy for the population percent information. |
a91c6e0
to
70fa94c
Compare
Available in the global data onder the 'territory_language' key.
70fa94c
to
cbd98d4
Compare
for language, info in get_global("territory_languages").get(territory, {}).items(): | ||
if info["official_status"] in allowed_stati: | ||
pairs.append((info["population_percent"], language)) | ||
pairs.sort(reverse=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be inclined to write:
languages = get_global("territory_languages").get(territory, {})
pairs = [(info['population_percent'], language)
for language, info in langs.iteritems()
if info['official_status'] in allowed_stati]
pairs.sort(reverse=True)
It should be a little faster and a bit more Pythonic to make more extensive use of comprehensions.
cbd98d4
to
935a0be
Compare
Switched to an admittedly more pythonic and more or less just as readable list comprehension as suggested by @etanol. Since patch coverage is 100% and overall coverage is increasing, I'll just go ahead and merge this :) |
This PR is a rebase of and supersedes #122 and #123.