diff --git a/README.md b/README.md index 687d5cd11563a49de6e781c1ab19b1b3bd271fe1..e62c041ab9b493376b9d8c7a4576790501c33db3 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/TRANSLATION.md b/TRANSLATION.md index b98db3d90ba4886b85a23bb1386372845ee3b4ae..e859ec0cbb4f9547ab7606aea3a0165fc143aefb 100644 --- a/TRANSLATION.md +++ b/TRANSLATION.md @@ -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. diff --git a/tools/generate-data.sh b/tools/generate-data.sh index 52e4e8fa73d1cc950062856efff5cdcd3b86e00c..dfeaaa4bfdebca32661f9c780b56a77ec32bd743 100755 --- a/tools/generate-data.sh +++ b/tools/generate-data.sh @@ -1,52 +1,12 @@ #!/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 diff --git a/tools/generate-gresource.sh b/tools/generate-gresource.sh new file mode 100755 index 0000000000000000000000000000000000000000..41074c2b9d8e8d50323447c91eab8b13f1b13116 --- /dev/null +++ b/tools/generate-gresource.sh @@ -0,0 +1,30 @@ +#!/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 diff --git a/tools/update-translations.sh b/tools/update-translations.sh new file mode 100755 index 0000000000000000000000000000000000000000..b79f651530a1d13bb53924d9e1ebb050f1a6a5f8 --- /dev/null +++ b/tools/update-translations.sh @@ -0,0 +1,25 @@ +#!/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