Skip to content
Snippets Groups Projects
generate_data.sh 1.51 KiB
Newer Older
# Copyright (c) 2019 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
Nico's avatar
Nico committed
    for file in briar-gtk/data/ui/*.ui about_dialog.ui
    do
        echo -n '    <file compressed="true" preprocess="xml-stripblanks">'
        echo -n $(basename $file)
        echo '</file>'
    done
    echo '  </gresource>'
    echo '</gresources>'
}

function generate_po()
{
    # git pull https://www.transifex.com/otf/briar/
    >briar-gtk.pot
Nico's avatar
Nico committed
    for file in ../data/app.briar.gtk.appdata.xml.in ../data/ui/about_dialog.ui.in ../data/ui/*.ui $(find "../briar_gtk" -name '*.py');
Nico's avatar
Nico committed
        xgettext --from-code=UTF-8 --no-location --no-wrap -j $file -o briar-gtk.pot
    done
    >LINGUAS
    for po in *.po
    do
Nico's avatar
Nico committed
        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
Nico's avatar
Nico committed
    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