generate_data.sh 1.52 KB
Newer Older
1
#!/bin/bash
2
3
4
5
# Copyright (c) 2019 Nico Alt
# SPDX-License-Identifier: AGPL-3.0-only
# License-Filename: LICENSE.md
#
6
7
8
9
10
11
12
13
# 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">'
14
    for file in briar-gtk/data/ui/*.css
15
16
17
18
19
    do
        echo -n '    <file compressed="true">'
        echo -n $(basename $file)
        echo '</file>'
    done
Nico's avatar
Nico committed
20
    for file in briar-gtk/data/ui/*.ui about_dialog.ui
21
22
23
24
25
26
27
28
29
30
31
    do
        echo -n '    <file compressed="true" preprocess="xml-stripblanks">'
        echo -n $(basename $file)
        echo '</file>'
    done
    echo '  </gresource>'
    echo '</gresources>'
}

function generate_po()
{
32
    cd briar-gtk/po
33
34
    # git pull https://www.transifex.com/otf/briar/
    >briar-gtk.pot
Nico's avatar
Nico committed
35
    for file in ../data/app.briar.gtk.metainfo.xml.in ../data/ui/about_dialog.ui.in ../data/ui/*.ui $(find "../briar_gtk" -name '*.py');
36
    do
Nico's avatar
Nico committed
37
        xgettext --from-code=UTF-8 --no-location --no-wrap -j $file -o briar-gtk.pot
38
39
40
41
    done
    >LINGUAS
    for po in *.po
    do
Nico's avatar
Nico committed
42
        msgmerge --no-wrap -N $po briar-gtk.pot > /tmp/$$language_new.po
43
44
45
46
        mv /tmp/$$language_new.po $po
        language=${po%.po}
        echo $language >>LINGUAS
    done
Nico's avatar
Nico committed
47
48
    sed -i -e '/^"POT-Creation-Date: /d' briar-gtk.pot
    sed -i -e '/^"POT-Creation-Date: /d' *.po
49
50
}

51
generate_resource > briar-gtk/data/ui/app.briar.gtk.gresource.xml
52
generate_po