Commit bc36c6c0 authored by Nico's avatar Nico
Browse files

Split up generate-data script

parent 9fea292c
......@@ -163,7 +163,7 @@ See [TRANSLATION.md](./TRANSLATION.md) for more information.
From time to time, translations and Flatpak's Python dependencies should be
updated. The former can be done with
`tools/generate-data.sh`, the latter using
`tools/update-translations.sh`, the latter using
[flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools).
## Design Goals
......
......@@ -12,7 +12,7 @@ translators at https://wiki.localizationlab.org/index.php/Briar.
_This section is of interest only for developers of Briar GTK_.
To update translations locally, first install `transifex-client`. You can then pull updates with `tx pull -a`.
Afterwards, you should execute `tools/generate-data.sh` to let gettext finish the update.
Afterwards, you should execute `tools/update-translations.sh` to let gettext finish the update.
The Localization Lab has some instructions and advice for
developers, too, at https://www.localizationlab.org/roles-guidelines#developer.
......
#!/bin/bash
# Copyright (c) 2019 Nico Alt
# Copyright (c) 2019-2020 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
#
# Initial version from GNOME Lollypop
# https://gitlab.gnome.org/World/lollypop/blob/1.0.2/generate_data.sh
function generate_resource()
{
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<gresources>'
echo ' <gresource prefix="/app/briar/gtk">'
for file in briar-gtk/data/ui/*.css
do
echo -n ' <file compressed="true">'
echo -n $(basename $file)
echo '</file>'
done
for file in briar-gtk/data/ui/*.ui about_dialog.ui briar-gtk/data/ui/app.briar.gtk.gschema.xml
do
echo -n ' <file compressed="true" preprocess="xml-stripblanks">'
echo -n $(basename $file)
echo '</file>'
done
echo ' </gresource>'
echo '</gresources>'
}
set -e -x
function generate_po()
{
cd briar-gtk/po
# git pull https://www.transifex.com/otf/briar/
>briar-gtk.pot
for file in ../data/app.briar.gtk.metainfo.xml.in ../data/ui/about_dialog.ui.in ../data/ui/*.ui $(find "../briar_gtk" -name '*.py');
do
xgettext --from-code=UTF-8 --no-location --no-wrap --keyword="_t:1c,2" -j $file -o briar-gtk.pot
done
>LINGUAS
for po in *.po
do
msgmerge --no-wrap -N $po briar-gtk.pot > /tmp/$$language_new.po
mv /tmp/$$language_new.po $po
language=${po%.po}
echo $language >>LINGUAS
done
sed -i -e '/^"POT-Creation-Date: /d' briar-gtk.pot
sed -i -e '/^"POT-Creation-Date: /d' *.po
}
generate_resource > briar-gtk/data/ui/app.briar.gtk.gresource.xml
generate_po
tools/generate-gresource.sh
tools/update-translations.sh
#!/bin/bash
# Copyright (c) 2019-2020 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
#
# Initial version from GNOME Lollypop
# https://gitlab.gnome.org/World/lollypop/blob/1.0.2/generate_data.sh
function generate_resource()
{
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<gresources>'
echo ' <gresource prefix="/app/briar/gtk">'
for file in briar-gtk/data/ui/*.css
do
echo -n ' <file compressed="true">'
echo -n $(basename $file)
echo '</file>'
done
for file in briar-gtk/data/ui/*.ui about_dialog.ui briar-gtk/data/ui/app.briar.gtk.gschema.xml
do
echo -n ' <file compressed="true" preprocess="xml-stripblanks">'
echo -n $(basename $file)
echo '</file>'
done
echo ' </gresource>'
echo '</gresources>'
}
generate_resource > briar-gtk/data/ui/app.briar.gtk.gresource.xml
#!/bin/bash
# Copyright (c) 2019-2020 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
#
# Initial version from GNOME Lollypop
# https://gitlab.gnome.org/World/lollypop/blob/1.0.2/generate_data.sh
cd briar-gtk/po
# git pull https://www.transifex.com/otf/briar/
>briar-gtk.pot
for file in ../data/app.briar.gtk.metainfo.xml.in ../data/ui/about_dialog.ui.in ../data/ui/*.ui $(find "../briar_gtk" -name '*.py');
do
xgettext --from-code=UTF-8 --no-location --no-wrap --keyword="_t:1c,2" -j $file -o briar-gtk.pot
done
>LINGUAS
for po in *.po
do
msgmerge --no-wrap -N $po briar-gtk.pot > /tmp/$$language_new.po
mv /tmp/$$language_new.po $po
language=${po%.po}
echo $language >>LINGUAS
done
sed -i -e '/^"POT-Creation-Date: /d' briar-gtk.pot
sed -i -e '/^"POT-Creation-Date: /d' *.po
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment