mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Split website and changelog translations
This commit is contained in:
parent
aca252eacf
commit
ff5039dd31
@ -139,17 +139,23 @@ class POT(Command): # {{{
|
|||||||
self.info('Generating translation template for website')
|
self.info('Generating translation template for website')
|
||||||
self.wn_path = os.path.expanduser('~/work/srv/main/static/generate.py')
|
self.wn_path = os.path.expanduser('~/work/srv/main/static/generate.py')
|
||||||
data = subprocess.check_output([self.wn_path, '--pot', '/tmp/wn'])
|
data = subprocess.check_output([self.wn_path, '--pot', '/tmp/wn'])
|
||||||
bdir = os.path.join(self.TRANSLATIONS, 'website')
|
data = json.loads(data)
|
||||||
|
|
||||||
|
def do(name):
|
||||||
|
messages = data[name]
|
||||||
|
bdir = os.path.join(self.TRANSLATIONS, name)
|
||||||
if not os.path.exists(bdir):
|
if not os.path.exists(bdir):
|
||||||
os.makedirs(bdir)
|
os.makedirs(bdir)
|
||||||
pot = os.path.join(bdir, 'website.pot')
|
pot = os.path.abspath(os.path.join(bdir, name + '.pot'))
|
||||||
with open(pot, 'wb') as f:
|
with open(pot, 'wb') as f:
|
||||||
f.write(self.pot_header().encode('utf-8'))
|
f.write(self.pot_header().encode('utf-8'))
|
||||||
f.write(b'\n')
|
f.write(b'\n')
|
||||||
f.write(data)
|
f.write('\n'.join(messages).encode('utf-8'))
|
||||||
self.info('Website translations:', os.path.abspath(pot))
|
self.upload_pot(resource=name)
|
||||||
self.upload_pot(resource='website')
|
self.git(['add', pot])
|
||||||
self.git(['add', os.path.abspath(pot)])
|
|
||||||
|
do('website')
|
||||||
|
do('changelog')
|
||||||
|
|
||||||
def pot_header(self, appname=__appname__, version=__version__):
|
def pot_header(self, appname=__appname__, version=__version__):
|
||||||
return textwrap.dedent('''\
|
return textwrap.dedent('''\
|
||||||
@ -427,7 +433,7 @@ class Translations(POT): # {{{
|
|||||||
|
|
||||||
if self.iso639_errors:
|
if self.iso639_errors:
|
||||||
for err in self.iso639_errors:
|
for err in self.iso639_errors:
|
||||||
print (err)
|
print(err)
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
dest = self.stats
|
dest = self.stats
|
||||||
|
Loading…
x
Reference in New Issue
Block a user