#!/usr/bin/perl -w

# Usage: ./parse_translations.pl file.ts

# This script opens file given as agrument (ment for .ts files
# from linguist, but name does not matter) and prints 
# out all translations.  It is very usefull when 
# checking final work.

# TIP: redirect output like this:
# ./parse_translations.pl file.ts | sort | uniq > check.txt
# and open in OpenOffice (or whatever editor with spellcheck)
# Yes, let program look for mistakes instead of us :]

# This code hopes it will be usefull for you
# Author: Adam ZAK, adam.zak@ynet.sk

$pocet_arg = $#ARGV + 1;

if ($pocet_arg != 1) {
 print "Usage: ./parse_translations.pl FILENAME\n";
 exit;
}

$arg = $ARGV[0];

open(IN,"<","$arg") or die("Error: Unable to open file '$arg'\n");

$obsah = "";

while ($line = <IN>) {
 $obsah .= $line;
} 

while ($obsah =~ /\<translation\>(.*?)\<\/translation\>/sig) {
 print $1 . "\n";
}
