1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-19 20:38:00 +01:00

add .sourceforge.net to the URLs in the translator

This commit is contained in:
Adam Blackburn
2009-06-04 22:24:14 +08:00
parent e8f0376a69
commit b10c959e9a

View File

@@ -20,6 +20,7 @@
from distutils.core import setup, Command
from distutils.extension import Extension
import os
import sys
import shutil
import subprocess
@@ -411,24 +412,22 @@ class get_translations(Command):
import urllib, shutil
shutil.rmtree('translations/')
os.makedirs('translations')
filename, headers = urllib.urlretrieve('http://wicd.net/translator/idlist')
filename, headers = urllib.urlretrieve('http://wicd.sourceforge.net/translator/idlist/')
id_file = open(filename, 'r')
lines = id_file.readlines()
# remove the \n from the end of lines, and remove blank entries
lines = [ x.strip() for x in lines if not x.strip() is '' ]
for id in lines:
# http://wicd.net/translator/download_po.php?language=11
pofile, poheaders = urllib.urlretrieve('http://wicd.net/translator/download/'+str(id))
#for i in `cat ids`; do
#wget "http://wicd.sourceforge.net/translator/download_po.php?language=$i&version=$1" -O "language_$i"
#iden=`python -c "import sys; print open('language_$i','r').readlines()[1].strip()[2:]"`
#mv "language_$i" po/$iden.po
#mkdir -p $iden/LC_MESSAGES/
#msgfmt --output-file=$iden/LC_MESSAGES/wicd.mo po/$iden.po
pofile, poheaders = urllib.urlretrieve('http://wicd.sourceforge.net/translator/download/'+str(id)+'/')
try:
lang_identifier = open(pofile,'r').readlines()[0].strip()
first_line = lang_identifier
lang_identifier = lang_identifier[lang_identifier.rindex('(')+1:lang_identifier.rindex(')')]
print first_line
except:
print >> sys.stderr, 'error downloading language %s' % id
else:
shutil.move(pofile, lang_identifier+'.po')
print 'Got',lang_identifier
os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES')
os.system('msgfmt --output-file=translations/' + lang_identifier +
'/LC_MESSAGES/wicd.mo ' + lang_identifier + '.po')