-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathut2po
executable file
·47 lines (45 loc) · 1.31 KB
/
ut2po
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
#!/bin/bash
if [[ $# -eq "$NO_ARGS" ]]
then
echo "Naudojimas: `basename $0` įvesties_txt_failas.txt išvesties_po_failas.po"
exit $E_OPTERROR
fi
if [[ -z "$1" ]]
then
echo "Nenurodytas įvesties failas"
exit $E_OPTERROR
fi
if [[ -z "$2" ]]
then
echo "Nenurodytas išvesties failas"
exit $E_OPTERROR
fi
rm ~id.txt ~id2.txt ~str.txt ~str2.txt
sed -i '/^[ \r\n\t]$/d' $1
sed -n 'p;n' $1>~id.txt
grep . ~id.txt >~id2.txt
sed -i 's/"/\\"/g' ~id2.txt
sed -i -n 's/^\(.*\)[\r$]/msgid \"\1"/p' ~id2.txt
sed -n 'n;p' $1>~str.txt
grep . ~str.txt >~str2.txt
sed -i 's/"/\\"/g' ~str2.txt
sed -i -n 's/^\(.*\)[\r$]/msgstr \"\1"/p' ~str2.txt
paste -d "\\n" ~id2.txt ~str2.txt>$2
sed -i '1 i\
msgid ""\
msgstr ""\
"Project-Id-Version: utorrent\\n"\
"Report-Msgid-Bugs-To: \\n"\
"POT-Creation-Date: 1970-01-01 00:00-0000\\n" \
"PO-Revision-Date: 1970-01-01 00:00-0000\\n" \
"Last-Translator: gymka <[email protected]>\\n" \
"Language-Team: lietuvių \\n" \
"MIME-Version: 1.0\\n" \
"Content-Type: text/plain; charset=UTF-8\\n" \
"Content-Transfer-Encoding: 8bit\\n" \
"Language: lt\\n" \
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2)\\n"' $2
#last=$(cat ~str.txt| tail '-1'|sed 's/\(.*\)/msgstr "\1"/')
#sed -i "$ i\
#${last}" $2
rm ~id.txt ~id2.txt ~str.txt ~str2.txt