Add translations files from zanata to the repository
Build .mo files and include them into bdist
This commit is contained in:
parent
d0de69ed4d
commit
02a7f24617
|
@ -2,3 +2,5 @@ include README.rst LICENSE.txt
|
|||
include examples/*.svg
|
||||
include documentation/presentation.odp
|
||||
include inkex/*.txt
|
||||
include po/*
|
||||
include scripts/boxes2pot scripts/boxes2inkscape
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,15 @@
|
|||
This directory contains the translation files. They are not checked in the
|
||||
git repository, though. The boxes.py.pot file gets generated from the sources
|
||||
This directory contains the translation files.
|
||||
|
||||
boxes.py.pot file gets generated from the sources
|
||||
and the actual translations are kept in Zanata:
|
||||
https://translate.zanata.org/iteration/view/boxes.py/master
|
||||
|
||||
use
|
||||
|
||||
zanata-cli pull
|
||||
|
||||
to get the new translations and
|
||||
|
||||
zanata-cli push
|
||||
|
||||
to put the .pot file on the server
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<config xmlns="http://zanata.org/namespace/config/">
|
||||
<url>https://translate.zanata.org/</url>
|
||||
<project>boxes.py</project>
|
||||
<project-version>master</project-version>
|
||||
<project-type>gettext</project-type>
|
||||
|
||||
</config>
|
File diff suppressed because it is too large
Load Diff
20
setup.py
20
setup.py
|
@ -25,17 +25,31 @@ class CustomBuildExtCommand(build_py):
|
|||
"xgettext -L Python -j -o po/boxes.py.pot",
|
||||
"boxes/*.py scripts/boxesserver scripts/boxes"))
|
||||
|
||||
def generate_mo_files(self):
|
||||
pos = glob.glob("po/*.po")
|
||||
|
||||
for po in pos:
|
||||
lang = po.split(os.sep)[1][:-3].replace("-", "_")
|
||||
try:
|
||||
os.makedirs(os.path.join("locale", lang, "LC_MESSAGES"))
|
||||
except FileExistsError:
|
||||
pass
|
||||
os.system("msgfmt %s -o locale/%s/LC_MESSAGES/boxes.py.mo" % (po, lang))
|
||||
self.distribution.data_files.append(
|
||||
(os.path.join("share", "locales", lang, "LC_MESSAGES"),
|
||||
[os.path.join("locales", lang, "LC_MESSAGES", "boxes.py.mo")]))
|
||||
|
||||
def run(self):
|
||||
if self.distribution.data_files is None:
|
||||
self.distribution.data_files = []
|
||||
self.execute(self.updatePOT, ())
|
||||
self.execute(self.generate_mo_files, ())
|
||||
self.execute(self.buildInkscapeExt, ())
|
||||
try:
|
||||
path = check_output(["inkscape", "-x"]).decode().strip()
|
||||
if not os.access(path, os.W_OK): # Can we install globaly
|
||||
# Not tested on Windows and Mac
|
||||
path = os.path.expanduser("~/.config/inkscape/extensions")
|
||||
|
||||
if self.distribution.data_files is None:
|
||||
self.distribution.data_files = []
|
||||
self.distribution.data_files.append(
|
||||
(path,
|
||||
[i for i in glob.glob(os.path.join("inkex", "*.inx"))]))
|
||||
|
|
Loading…
Reference in New Issue