File: parse_translations.pl

package info (click to toggle)
cdcat 0.99-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,124 kB
  • ctags: 1,574
  • sloc: cpp: 18,143; makefile: 58; perl: 37; xml: 6
file content (37 lines) | stat: -rwxr-xr-x 922 bytes parent folder | download | duplicates (3)
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
#!/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";
}