Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
18edf12c
Commit
18edf12c
authored
Feb 19, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PyICU for getting languge names
parent
1eaa8776
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
scripts/list-translated-languages
scripts/list-translated-languages
+25
-6
No files found.
scripts/list-translated-languages
View file @
18edf12c
...
...
@@ -3,14 +3,30 @@
import
json
import
urllib2
import
imp
import
PyICU
URL
=
'http://l10n.cihar.com/exports/stats/weblate/master/'
THRESHOLD
=
20
def
print_language
(
lang
,
fmt
=
'{0} ({1})'
):
'''
Prints language code with it's name.
'''
locale
=
PyICU
.
Locale
(
lang
)
print
(
fmt
.
format
(
lang
,
locale
.
getDisplayName
(
locale
).
capitalize
().
encode
(
'utf-8'
)
)
)
def
main
():
# load data
fp
=
urllib2
.
urlopen
(
URL
)
data
=
fp
.
read
()
handle
=
urllib2
.
urlopen
(
URL
)
data
=
handle
.
read
()
handle
.
close
()
# parse data
data
=
json
.
loads
(
data
)
...
...
@@ -20,8 +36,9 @@ def main():
if
lang
[
'translated_percent'
]
>
THRESHOLD
:
languages
.
append
(
lang
[
'code'
])
languages
.
sort
()
print
'Found languages:'
print
'
\
n
'
.
join
(
languages
)
print
'Expected setup:'
for
lang
in
languages
:
print_language
(
lang
,
fmt
=
" ('{0}', u'{1}'),"
)
# prepare for checking
languages
=
set
(
languages
)
...
...
@@ -38,10 +55,12 @@ def main():
# Print results
if
len
(
extra
)
>
0
:
print
'Extra languages:'
print
'
\
n
'
.
join
(
extra
)
for
lang
in
extra
:
print_language
(
lang
)
if
len
(
languages
)
>
0
:
print
'Missing languages:'
print
'
\
n
'
.
join
(
languages
)
for
lang
in
languages
:
print_language
(
lang
)
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment