replace gettext and intltool with Babel

This commit is contained in:
Matt Rose 2020-05-10 20:52:23 -04:00
parent 51cf811561
commit bd9c7691eb
7 changed files with 45 additions and 1843 deletions

5
.gitignore vendored
View File

@ -19,8 +19,3 @@ remotinatorc
terminatorlib/meliae
/dist
/MANIFEST
## language / intltool related files
.intltool*
data/terminator.appdata.xml
data/terminator.desktop

7
babel.cfg Normal file
View File

@ -0,0 +1,7 @@
[python: **.py]
[python: terminator]
[python: remotinator]
[glade: **.glade]
[glade: data/terminator.metadata.xml]
[desktop: **.desktop]

View File

@ -2,47 +2,47 @@
<!-- Copyright 2013 Stephen Boddy <stephen.j.boddy@gmail.com> -->
<component type="desktop">
<id>terminator.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0 only</project_license>
<_name>Terminator</_name>
<_summary>Multiple terminals in one window</_summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0 only</project_license>
<name translatable="yes">Terminator</name>
<summary translatable="yes">Multiple terminals in one window</summary>
<description>
<_p>
<p translatable="yes">
The robot future of terminals
</_p>
<_p>
</p>
<p translatable="yes">
A power-user tool for arranging terminals. It is inspired by programs such as
gnome-multi-term, quadkonsole, etc. in that the main focus is arranging terminals
in grids (tabs is the most common default method, which Terminator also supports).
</_p>
<_p>
</p>
<p translatable="yes">
Much of the behavior of Terminator is based on GNOME Terminal, and we are adding
more features from that as time goes by, but we also want to extend out in different
directions with useful features for sysadmins and other users.
</_p>
<_p>Some highlights:</_p>
</p>
<p translatable="yes">Some highlights:</p>
<ul>
<_li>Arrange terminals in a grid</_li>
<_li>Tabs</_li>
<_li>Drag and drop re-ordering of terminals</_li>
<_li>Lots of keyboard shortcuts</_li>
<_li>Save multiple layouts and profiles via GUI preferences editor</_li>
<_li>Simultaneous typing to arbitrary groups of terminals</_li>
<li translatable="yes">Arrange terminals in a grid</li>
<li translatable="yes">Tabs</li>
<li translatable="yes">Drag and drop re-ordering of terminals</li>
<li translatable="yes">Lots of keyboard shortcuts</li>
<li translatable="yes">Save multiple layouts and profiles via GUI preferences editor</li>
<li translatable="yes">Simultaneous typing to arbitrary groups of terminals</li>
</ul>
<_p>And lots more...</_p>
<p translatable="yes">And lots more...</p>
</description>
<screenshots>
<screenshot type="default">
<image>http://4.bp.blogspot.com/-xt4Tja1TMQ0/Vdemmf8wYSI/AAAAAAAAA9A/uROTre0PMls/s1600/terminator_main_basic.png</image>
<_caption>The main window showing the application in action</_caption>
<caption translatable="yes">The main window showing the application in action</caption>
</screenshot>
<screenshot>
<image>http://4.bp.blogspot.com/-rRxALSpEEZw/Vdeu58JgpnI/AAAAAAAAA9o/XewWKJ5HNo4/s1600/terminator_main_complex.png</image>
<_caption>Getting a little crazy with the terminals</_caption>
<caption translatable="yes">Getting a little crazy with the terminals</caption>
</screenshot>
<screenshot>
<image>http://2.bp.blogspot.com/-t_8oRyMXUls/VdemmRVnZnI/AAAAAAAAA88/rHIr8L1X7Ho/s1600/terminator_prefs_global.png</image>
<_caption>The preferences window where you can change the defaults</_caption>
<image>http://2.bp.blogspot.com/-t_8oRyMXUls/VdemmRVnZnI/AAAAAAAAA88/rHIr8L1X7Ho/s1600/terminatorp translatable="yes"refs_global.png</image>
<caption translatable="yes">The preferences window where you can change the defaults</caption>
</screenshot>
</screenshots>
<url type="homepage">https://github.com/gnome-terminator/terminator</url>

View File

@ -1,11 +1,4 @@
#!/bin/sh
# Stupid workaround for intltools not handling extensionless files
ln -s terminator ../terminator.py
ln -s remotinator ../remotinator.py
# Make translation files
intltool-update -g terminator -o terminator.pot -p
# Cleanup after stupid workaround
rm ../terminator.py
rm ../remotinator.py
cd ..
python setup.py extract_messages
cd po

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,7 @@
[aliases]
test=pytest
[extract_messages]
mapping_file = babel.cfg
output_file = po/terminator.pot
input_dirs = .

View File

@ -56,36 +56,12 @@ class BuildData(build):
if newer(po, mo):
info('compiling %s -> %s' % (po, mo))
try:
rc = subprocess.call(['msgfmt', '-o', mo, po])
if rc != 0:
raise Warning("msgfmt returned %d" % rc)
except Exception as e:
error("Building gettext files failed. Ensure you have gettext installed. Alternatively, try setup.py --without-gettext [build|install]")
error("Error: %s" % str(e))
sys.exit(1)
TOP_BUILDDIR='.'
INTLTOOL_MERGE='intltool-merge'
desktop_in='data/terminator.desktop.in'
desktop_data='data/terminator.desktop'
rc = os.system ("C_ALL=C " + INTLTOOL_MERGE + " -d -u -c " + TOP_BUILDDIR +
"/po/.intltool-merge-cache " + TOP_BUILDDIR + "/po " +
desktop_in + " " + desktop_data)
if rc != 0:
# run the desktop_in through a command to strip the "_" characters
with open(desktop_in) as file_in, open(desktop_data, 'w') as file_data:
[file_data.write(line.lstrip('_')) for line in file_in]
appdata_in='data/terminator.appdata.xml.in'
appdata_data='data/terminator.metainfo.xml'
rc = os.system ("C_ALL=C " + INTLTOOL_MERGE + " -x -u -c " + TOP_BUILDDIR +
"/po/.intltool-merge-cache " + TOP_BUILDDIR + "/po " +
appdata_in + " " + appdata_data)
if rc != 0:
# run the appdata_in through a command to strip the "_" characters
with open(appdata_in) as file_in, open(appdata_data, 'w') as file_data:
[file_data.write(line.replace('<_','<').replace('</_','</')) for line in file_in]
from babel.messages.frontend import compile_catalog
compiler = compile_catalog(self.distribution)
compiler.domain = ['terminator']
compiler.input_file = po
compiler.output_file = mo
compiler.run()
class Uninstall(Command):
description = "Attempt an uninstall from an install --record file"
@ -229,6 +205,8 @@ setup(name=APP_NAME,
],
setup_requires=[
'pytest-runner',
'babel',
'BabelGladeExtractor',
],
install_requires=[
'pycairo',