-
Notifications
You must be signed in to change notification settings - Fork 8
/
make-pot
executable file
·76 lines (69 loc) · 3.13 KB
/
make-pot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#! /bin/bash
# This script extracts the typical xgettext invokation out of
# po/Makefile.in.in, in order for it to be available as a shell
# command without the need to autogen first. This is needed for
# translation tools such as the damn lies website.
#
# Call this from your checkout directory, like this:
#
# ./make-pot
#
# to generate po/gnome-recipes.pot, and like this:
#
# ./make-pot data
#
# Various things can be passed in by environment variables, which
# are heavily inspired by the variables used in po/Makefile.in.in:
#
# SED - path to the sed binary
# XGETTEXT - path of the xgettext binary
# top_srcdir - the location of the GTK+ checkout
# srcdir - the directory where POTFILES.in is located (defaults to
# $top_srcdir/po or $top_srcdir/po-properties)
# GETTEXT_PACKAGE - the gettext domain, used for naming the resulting
# .pot file (defaults to gtk40 or gtk40-properties)
# XGETTEXT_KEYWORDS - --keyword arguments to pass to xgettext
SED="${SED:-sed}"
XGETTEXT="${XGETTEXT:-xgettext}"
top_srcdir="${top_srcdir:-.}"
if test "$1" = "data"; then
srcdir="${srcdir:-$top_srcdir/po-data}"
GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gnome-recipes-data}"
XGETTEXT_KEYWORDS="${XGETTEXT_KEYWORDS:- --keyword --keyword=N_ }"
else
srcdir="${srcdir:-$top_srcdir/po}"
GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gnome-recipes}"
XGETTEXT_KEYWORDS="${XGETTEXT_KEYWORDS:- --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=gettext --keyword=ngettext:1,2 --keyword=g_dngettext:2,3 }"
fi
$SED -e 's/^\(.*\)$/ N_("\1"),/' $top_srcdir/data/ingredients.list > $top_srcdir/src/ingredients.inc
$SED -e 's/^\(.*\)$/ N_("no \1"),/' $top_srcdir/data/ingredients.list > $top_srcdir/src/no-ingredients.inc
$SED -e 's/^\(.*\)$/ N_("\1"),/' $top_srcdir/data/segments.list > $top_srcdir/src/segments.inc
$XGETTEXT --default-domain="$GETTEXT_PACKAGE" \
--directory="$top_srcdir" \
--add-comments \
$XGETTEXT_KEYWORDS \
--from-code=utf-8 \
--flag=g_dngettext:2:pass-c-format \
--flag=g_strdup_printf:1:c-format \
--flag=g_string_printf:2:c-format \
--flag=g_string_append_printf:2:c-format \
--flag=g_error_new:3:c-format \
--flag=g_set_error:4:c-format \
--flag=g_markup_printf_escaped:1:c-format \
--flag=g_log:3:c-format \
--flag=g_print:1:c-format \
--flag=g_printerr:1:c-format \
--flag=g_printf:1:c-format \
--flag=g_fprintf:2:c-format \
--flag=g_sprintf:2:c-format \
--flag=g_snprintf:3:c-format \
--flag=g_scanner_error:2:c-format \
--flag=g_scanner_warn:2:c-format \
--flag=gtk_message_dialog_format_secondary_markup:2:c-format \
--flag=gtk_message_dialog_format_secondary_text:2:c-format \
--flag=gtk_message_dialog_new:5:c-format \
--flag=gtk_message_dialog_new_with_markup:5:c-format \
--files-from="$srcdir/POTFILES.in" \
&& test ! -f "$GETTEXT_PACKAGE.po" \
|| ( rm -f "$srcdir/$GETTEXT_PACKAGE.pot" \
&& mv "$GETTEXT_PACKAGE.po" "$srcdir/$GETTEXT_PACKAGE.pot" )