po / glossary / txt-to-pot.shon commit Merge branch 'maint' (f4e9996)
   1#!/bin/sh
   2# This is a very, _very_, simple script to convert a tab-separated
   3# .txt file into a .pot/.po.
   4# Its not clever but it took me 2 minutes to write :)
   5# Michael Twomey <michael.twomey@ireland.sun.com>
   6# 23 March 2001
   7# with slight GnuCash modifications by Christian Stimming <stimming@tuhh.de>
   8# 19 Aug 2001, 23 Jul 2007
   9
  10#check args
  11if [ $# -eq 0 ]
  12then
  13        cat <<!
  14Usage: `basename $0` git-gui-glossary.txt > git-gui-glossary.pot
  15!
  16        exit 1;
  17fi
  18
  19GLOSSARY_CSV="$1";
  20
  21if [ ! -f "$GLOSSARY_CSV" ]
  22then
  23        echo "Can't find $GLOSSARY_CSV.";
  24        exit 1;
  25fi
  26
  27cat <<!
  28# SOME DESCRIPTIVE TITLE.
  29# Copyright (C) YEAR Free Software Foundation, Inc.
  30# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
  31#
  32#, fuzzy
  33msgid ""
  34msgstr ""
  35"Project-Id-Version: PACKAGE VERSION\n"
  36"POT-Creation-Date: `date +'%Y-%m-%d %H:%M%z'`\n"
  37"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  38"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  39"Language-Team: LANGUAGE <LL@li.org>\n"
  40"MIME-Version: 1.0\n"
  41"Content-Type: text/plain; charset=CHARSET\n"
  42"Content-Transfer-Encoding: ENCODING\n"
  43
  44!
  45
  46#Yes this is the most simple awk script you've ever seen :)
  47awk -F'\t' '{if ($2 != "") print "#. "$2; print "msgid "$1; print "msgstr \"\"\n"}' \
  48$GLOSSARY_CSV