My favorites | Sign in
Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/python
# -*- coding: utf-8 -*-

from urllib import urlopen
from BeautifulSoup import BeautifulSoup
import codecs

# Languages sorted by name.
langs = ('az', 'ar', 'pt_BR', 'bg', 'ca', 'cs', 'da', 'nl',
'en_GB', 'et', 'fi', 'fr', 'gl', 'de', 'el', 'he',
'hi', 'hu', 'ga', 'it', 'ja', 'nb', 'oc', 'fa', 'pl',
'pt', 'ro', 'ru', 'sk', 'es', 'sv', 'tr', 'wa', )

print "Getting data from Rosetta Launchpad."
filename = 'TRANSLATORS'
pychess = ("PyChess is translated into %s languages.\n" % len(langs))
f = codecs.open(filename, 'a', 'utf-8')
f.write(u'%s' % pychess)
f.close()

for lang in langs:
site = "https://translations.launchpad.net/pychess/trunk/+pots/pychess/%s/+translate" % lang
page = urlopen(site).read()
soup = BeautifulSoup(page)
names = soup.find("div", {"class":"portletContent"})
l = soup('title')[0].string
language = l.split("into ")[1]
ltranslators = u"\n%s translators:\n" % language
print ("processing '%s'...") % lang
f = codecs.open(filename, 'a', 'utf-8')
f.write(u'%s' % ltranslators)
f.close()
# TODO: getting email address of translators.
for link in names.findChildren("a"):
f = codecs.open(filename, 'a', 'utf-8')
f.write(u'%s\n' % link.string)
f.close()
Show details Hide details

Change log

r999 by leogregianin on May 24, 2008   Diff
translators list save in file
Go to: 
Project members, sign in to write a code review

Older revisions

r991 by leogregianin on May 22, 2008   Diff
extract all translators by language
All revisions of this file

File info

Size: 1296 bytes, 37 lines
Hosted by Google Code