3 changed files with 32 additions and 64 deletions
@ -1,63 +0,0 @@ |
|||||||
#!/usr/bin/python |
|
||||||
from StringIO import StringIO |
|
||||||
import urllib2, os, zipfile, pycurl |
|
||||||
|
|
||||||
crowdin_identifier = 'electrum' |
|
||||||
crowdin_file_name = 'electrum-client/messages.pot' |
|
||||||
locale_file_name = 'locale/messages.pot' |
|
||||||
|
|
||||||
if os.path.exists('contrib/crowdin_api_key.txt'): |
|
||||||
crowdin_api_key = open('contrib/crowdin_api_key.txt').read().strip() |
|
||||||
|
|
||||||
# Generate fresh translation template |
|
||||||
if not os.path.exists('locale'): |
|
||||||
os.mkdir('locale') |
|
||||||
|
|
||||||
cmd = 'xgettext -s --no-wrap -f app.fil --output=locale/messages.pot' |
|
||||||
print 'Generate template' |
|
||||||
os.system(cmd) |
|
||||||
|
|
||||||
# Push to Crowdin |
|
||||||
print 'Push to Crowdin' |
|
||||||
url = ('http://api.crowdin.net/api/project/' + crowdin_identifier + '/update-file?key=' + crowdin_api_key) |
|
||||||
|
|
||||||
c = pycurl.Curl() |
|
||||||
c.setopt(c.URL, url) |
|
||||||
c.setopt(c.POST, 1) |
|
||||||
fields = [('files[' + crowdin_file_name + ']', (pycurl.FORM_FILE, locale_file_name))] |
|
||||||
c.setopt(c.HTTPPOST, fields) |
|
||||||
c.perform() |
|
||||||
|
|
||||||
# Build translations |
|
||||||
print 'Build translations' |
|
||||||
response = urllib2.urlopen('http://api.crowdin.net/api/project/' + crowdin_identifier + '/export?key=' + crowdin_api_key).read() |
|
||||||
print response |
|
||||||
|
|
||||||
# Download & unzip |
|
||||||
print 'Download translations' |
|
||||||
zfobj = zipfile.ZipFile(StringIO(urllib2.urlopen('http://crowdin.net/download/project/' + crowdin_identifier + '.zip').read())) |
|
||||||
|
|
||||||
print 'Unzip translations' |
|
||||||
for name in zfobj.namelist(): |
|
||||||
if not name.startswith('electrum-client/locale'): |
|
||||||
continue |
|
||||||
if name.endswith('/'): |
|
||||||
if not os.path.exists(name[16:]): |
|
||||||
os.mkdir(name[16:]) |
|
||||||
else: |
|
||||||
output = open(name[16:],'w') |
|
||||||
output.write(zfobj.read(name)) |
|
||||||
output.close() |
|
||||||
|
|
||||||
# Convert .po to .mo |
|
||||||
print 'Installing' |
|
||||||
for lang in os.listdir('./locale'): |
|
||||||
if lang.startswith('messages'): |
|
||||||
continue |
|
||||||
# Check LC_MESSAGES folder |
|
||||||
mo_dir = 'locale/%s/LC_MESSAGES' % lang |
|
||||||
if not os.path.exists(mo_dir): |
|
||||||
os.mkdir(mo_dir) |
|
||||||
cmd = 'msgfmt --output-file="%s/electrum.mo" "locale/%s/electrum.po"' % (mo_dir,lang) |
|
||||||
print 'Installing',lang |
|
||||||
os.system(cmd) |
|
||||||
@ -0,0 +1,31 @@ |
|||||||
|
Plugin rules: |
||||||
|
|
||||||
|
* The plugin system of Electrum is designed to allow the development |
||||||
|
of new features without increasing the core code of Electrum. |
||||||
|
|
||||||
|
* Electrum is written in pure python. if you want to add a feature |
||||||
|
that requires non-python libraries, then it must be submitted as a |
||||||
|
plugin. If the feature you want to add requires communication with |
||||||
|
a remote server (not an Electrum server), then it should be a |
||||||
|
plugin as well. If the feature you want to add introduces new |
||||||
|
dependencies in the code, then it should probably be a plugin. |
||||||
|
|
||||||
|
* We expect plugin developers to maintain their plugin code. However, |
||||||
|
once a plugin is merged in Electrum, we will have to maintain it |
||||||
|
too, because changes in the Electrum code often require updates in |
||||||
|
the plugin code. Therefore, plugins have to be easy to maintain. If |
||||||
|
we believe that a plugin will create too much maintenance work in |
||||||
|
the future, it will be rejected. |
||||||
|
|
||||||
|
* Plugins should be compatible with Electrum's conventions. If your |
||||||
|
plugin does not fit with Electrum's architecture, or if we believe |
||||||
|
that it will create too much maintenance work, it will not be |
||||||
|
accepted. In particular, do not duplicate existing Electrum code in |
||||||
|
your plugin. |
||||||
|
|
||||||
|
* We may decide to remove a plugin after it has been merged in |
||||||
|
Electrum. For this reason, a plugin must be easily removable, |
||||||
|
without putting at risk the user's bitcoins. If we feel that a |
||||||
|
plugin cannot be removed without threatening users who rely on it, |
||||||
|
we will not merge it. |
||||||
|
|
||||||
Loading…
Reference in new issue