Blame make-pot

Packit 496598
#! /bin/bash
Packit 496598
Packit 496598
# This script extracts the typical xgettext invokation out of
Packit 496598
# po/Makefile.in.in, in order for it to be available as a shell
Packit 496598
# command without the need to autogen first. This is needed for
Packit 496598
# translation tools such as the damn lies website.
Packit 496598
#
Packit 496598
# Call this from your GTK+ checkout directory, like this:
Packit 496598
#
Packit 496598
#   ./make-pot
Packit 496598
#
Packit 496598
# to generate po/gtk30.pot, and like this:
Packit 496598
#
Packit 496598
#   ./make-pot properties
Packit 496598
#
Packit 496598
# to generate po-properties/gtk30-properties.pot.
Packit 496598
#
Packit 496598
# Various things can be passed in by environment variables, which
Packit 496598
# are heavily inspired by the variables used in po/Makefile.in.in:
Packit 496598
#
Packit 496598
# XGETTEXT - path of the xgettext binary
Packit 496598
# top_srcdir - the location of the GTK+ checkout
Packit 496598
# srcdir - the directory where POTFILES.in is located (defaults to
Packit 496598
#          $top_srcdir/po or $top_srcdir/po-properties)
Packit 496598
# GETTEXT_PACKAGE - the gettext domain, used for naming the resulting
Packit 496598
#          .pot file (defaults to gtk30 or gtk30-properties)
Packit 496598
# XGETTEXT_KEYWORDS - --keyword arguments to pass to xgettext
Packit 496598
Packit 496598
Packit 496598
XGETTEXT="${XGETTEXT:-xgettext}"
Packit 496598
top_srcdir="${top_srcdir:-.}"
Packit 496598
Packit 496598
if test "$1" = "properties"; then
Packit 496598
  srcdir="${srcdir:-$top_srcdir/po-properties}"
Packit 496598
  GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gtk30-properties}"
Packit 496598
  XGETTEXT_KEYWORDS="${XGETTEXT_KEYWORDS:- --keyword --keyword=P_ }"
Packit 496598
else
Packit 496598
  srcdir="${srcdir:-$top_srcdir/po}"
Packit 496598
  GETTEXT_PACKAGE="${GETTEXT_PACKAGE:-gtk30}"
Packit 496598
  XGETTEXT_KEYWORDS="${XGETTEXT_KEYWORDS:- --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 }"
Packit 496598
fi
Packit 496598
Packit 496598
$XGETTEXT --default-domain="$GETTEXT_PACKAGE" \
Packit 496598
          --directory="$top_srcdir" \
Packit 496598
          --add-comments \
Packit 496598
          $XGETTEXT_KEYWORDS \
Packit 496598
          --from-code=utf-8 \
Packit 496598
          --flag=g_dngettext:2:pass-c-format \
Packit 496598
          --flag=g_strdup_printf:1:c-format \
Packit 496598
          --flag=g_string_printf:2:c-format \
Packit 496598
          --flag=g_string_append_printf:2:c-format \
Packit 496598
          --flag=g_error_new:3:c-format \
Packit 496598
          --flag=g_set_error:4:c-format \
Packit 496598
          --flag=g_markup_printf_escaped:1:c-format \
Packit 496598
          --flag=g_log:3:c-format \
Packit 496598
          --flag=g_print:1:c-format \
Packit 496598
          --flag=g_printerr:1:c-format \
Packit 496598
          --flag=g_printf:1:c-format \
Packit 496598
          --flag=g_fprintf:2:c-format \
Packit 496598
          --flag=g_sprintf:2:c-format \
Packit 496598
          --flag=g_snprintf:3:c-format \
Packit 496598
          --flag=g_scanner_error:2:c-format \
Packit 496598
          --flag=g_scanner_warn:2:c-format \
Packit 496598
          --flag=gtk_message_dialog_format_secondary_markup:2:c-format \
Packit 496598
          --flag=gtk_message_dialog_format_secondary_text:2:c-format \
Packit 496598
          --flag=gtk_message_dialog_new:5:c-format \
Packit 496598
          --flag=gtk_message_dialog_new_with_markup:5:c-format \
Packit 496598
          --files-from="$srcdir/POTFILES.in" \
Packit 496598
        && test ! -f "$GETTEXT_PACKAGE.po" \
Packit 496598
           || ( rm -f "$srcdir/$GETTEXT_PACKAGE.pot" \
Packit 496598
                && mv "$GETTEXT_PACKAGE.po" "$srcdir/$GETTEXT_PACKAGE.pot" )
Packit 496598