mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Start work on migrating to transifex. See https://srctwig.com/2012/08/02/localisation-with-git-and-transifex/ for a nice summary of workflow using the command line tool
This commit is contained in:
parent
8908f0b83c
commit
2363f44a65
3
.gitignore
vendored
3
.gitignore
vendored
@ -29,6 +29,9 @@ src/cssutils/stylesheets/.svn/
|
|||||||
src/odf/.svn
|
src/odf/.svn
|
||||||
tags
|
tags
|
||||||
nbproject/
|
nbproject/
|
||||||
|
translations/calibre/*.po
|
||||||
|
translations/calibre/*.pot
|
||||||
|
translations/iso_639/*.po
|
||||||
*.mdproj
|
*.mdproj
|
||||||
*.pidb
|
*.pidb
|
||||||
*.sln
|
*.sln
|
||||||
|
@ -23,19 +23,10 @@ def qt_sources():
|
|||||||
class POT(Command): # {{{
|
class POT(Command): # {{{
|
||||||
|
|
||||||
description = 'Update the .pot translation template and upload it'
|
description = 'Update the .pot translation template and upload it'
|
||||||
LP_BASE = os.path.join(os.path.dirname(Command.SRC))
|
TRANSLATIONS = os.path.join(os.path.dirname(Command.SRC), 'translations')
|
||||||
if not os.path.exists(os.path.join(LP_BASE, 'setup', 'iso_639')):
|
|
||||||
# We are in a git checkout, translations are assumed to be in a
|
|
||||||
# directory called calibre-translations at the same level as the
|
|
||||||
# calibre directory.
|
|
||||||
LP_BASE = os.path.join(os.path.dirname(os.path.dirname(Command.SRC)), 'calibre-translations')
|
|
||||||
LP_SRC = os.path.join(LP_BASE, 'src')
|
|
||||||
LP_PATH = os.path.join(LP_SRC, os.path.join(__appname__, 'translations'))
|
|
||||||
LP_ISO_PATH = os.path.join(LP_BASE, 'setup', 'iso_639')
|
|
||||||
|
|
||||||
def upload_pot(self, pot):
|
def upload_pot(self, pot):
|
||||||
msg = 'Updated translations template'
|
return # TODO: Implement this
|
||||||
subprocess.check_call(['bzr', 'commit', '-m', msg, pot])
|
|
||||||
|
|
||||||
def source_files(self):
|
def source_files(self):
|
||||||
ans = []
|
ans = []
|
||||||
@ -78,7 +69,7 @@ class POT(Command): # {{{
|
|||||||
return '\n'.join(ans)
|
return '\n'.join(ans)
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
require_git_master()
|
# require_git_master() TODO: Re-enable this once migration is done
|
||||||
pot_header = textwrap.dedent('''\
|
pot_header = textwrap.dedent('''\
|
||||||
# Translation template file..
|
# Translation template file..
|
||||||
# Copyright (C) %(year)s Kovid Goyal
|
# Copyright (C) %(year)s Kovid Goyal
|
||||||
@ -126,7 +117,10 @@ class POT(Command): # {{{
|
|||||||
os.remove(out.name)
|
os.remove(out.name)
|
||||||
src = pot_header + '\n' + src
|
src = pot_header + '\n' + src
|
||||||
src += '\n\n' + self.get_tweaks_docs()
|
src += '\n\n' + self.get_tweaks_docs()
|
||||||
pot = os.path.join(self.LP_PATH, __appname__+'.pot')
|
bdir = os.path.join(self.TRANSLATIONS, __appname__)
|
||||||
|
if not os.path.exists(bdir):
|
||||||
|
os.makedirs(bdir)
|
||||||
|
pot = os.path.join(bdir, 'main.pot')
|
||||||
# Workaround for bug in xgettext:
|
# Workaround for bug in xgettext:
|
||||||
# https://savannah.gnu.org/bugs/index.php?41668
|
# https://savannah.gnu.org/bugs/index.php?41668
|
||||||
src = re.sub(r'#, python-brace-format\s+msgid ""\s+.*<code>{0:</code>',
|
src = re.sub(r'#, python-brace-format\s+msgid ""\s+.*<code>{0:</code>',
|
||||||
@ -265,7 +259,6 @@ class GetTranslations(Translations): # {{{
|
|||||||
|
|
||||||
description = 'Get updated translations from Launchpad'
|
description = 'Get updated translations from Launchpad'
|
||||||
BRANCH = 'lp:~kovid/calibre/translations'
|
BRANCH = 'lp:~kovid/calibre/translations'
|
||||||
LP_BASE = os.path.dirname(POT.LP_SRC)
|
|
||||||
CMSG = 'Updated translations'
|
CMSG = 'Updated translations'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
3
translations/.tx/config
Normal file
3
translations/.tx/config
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[main]
|
||||||
|
host = https://www.transifex.com
|
||||||
|
|
1
translations/calibre/placeholder
Normal file
1
translations/calibre/placeholder
Normal file
@ -0,0 +1 @@
|
|||||||
|
for git
|
3
translations/iso_639/README
Normal file
3
translations/iso_639/README
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
These files are taken from the iso-codes package, licensed under the LGPL 2.1
|
||||||
|
|
||||||
|
All the files are from the iso_639_3 sub-directory.
|
30845
translations/iso_639/iso_639_3.pot
Normal file
30845
translations/iso_639/iso_639_3.pot
Normal file
File diff suppressed because it is too large
Load Diff
39178
translations/iso_639/iso_639_3.xml
Normal file
39178
translations/iso_639/iso_639_3.xml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user