Translation update done using Pootle.
[phpmyadmin-themes.git] / scripts / php2gettext.sh
blob4901be5480ae389960d4aa12314034f63bc5e78e
1 #!/bin/sh
3 mkdir -p po
6 sed "
7 s/' ;/';/;
8 /to translate/D;
9 /\$allow_recoding/D;
10 s/\$byteUnits = array('\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)');/\$str_B = '\1';\n\$str_KiB = '\2';\n\$str_MiB = '\3';\n\$str_GiB = '\4';\n\$str_TiB = '\5';\n\$str_PiB = '\6';\n\$str_EiB = '\7';/;
11 s/\$day_of_week = array('\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)');/\$str_Sun = '\1';\n\$str_Mon = '\2';\n\$str_Tue = '\3';\n\$str_Wed = '\4';\n\$str_Thu = '\5';\n\$str_Fri = '\6';\n\$str_Sat = '\7';\n/;
12 s/\(\$month = array('.*', '.*', '.*', '.*', '.*', '.*',\) '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)');/\1\n\$str_Jul = '\2';\n\$str_Aug = '\3';\n\$str_Sep = '\4';\n\$str_Oct = '\5';\n\$str_Nov = '\6';\n\$str_Dec = '\7';\n/;
13 s/\$month = array('\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)', '\(.*\)',/\$str_Jan = '\1';\n\$str_Feb = '\2';\n\$str_Mar = '\3';\n\$str_Apr = '\4';\n\$str_May = '\5';\n\$str_Jun = '\6';\n/;
14 " < lang/english-utf-8.inc.php > po/english.php
16 for lang in lang/*.inc.php ; do
17 loc=`basename $lang | sed 's/-utf-8.inc.php//'`
18 # Unfold arrays, delete not translated strings
19 sed "
20 s/' ;/';/;
21 /to translate/D;
22 /^\/\//D;
23 /\$allow_recoding/D;
24 s/\$byteUnits *= *array('\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)');/\$str_B = '\1';\n\$str_KiB = '\2';\n\$str_MiB = '\3';\n\$str_GiB = '\4';\n\$str_TiB = '\5';\n\$str_PiB = '\6';\n\$str_EiB = '\7';/;
25 s/\$day_of_week *= *array('\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)');/\$str_Sun = '\1';\n\$str_Mon = '\2';\n\$str_Tue = '\3';\n\$str_Wed = '\4';\n\$str_Thu = '\5';\n\$str_Fri = '\6';\n\$str_Sat = '\7';\n/;
26 s/\(\$month *= *array('.*', *'.*', *'.*', *'.*', *'.*', *'.*',\) '\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)');/\1\n\$str_Jul = '\2';\n\$str_Aug = '\3';\n\$str_Sep = '\4';\n\$str_Oct = '\5';\n\$str_Nov = '\6';\n\$str_Dec = '\7';\n/;
27 s/\$month *= *array('\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)', *'\(.*\)',/\$str_Jan = '\1';\n\$str_Feb = '\2';\n\$str_Mar = '\3';\n\$str_Apr = '\4';\n\$str_May = '\5';\n\$str_Jun = '\6';\n/;
28 " < $lang > po/$loc.php
30 case $loc in
31 afrikaans) langcode='af';;
32 arabic) langcode='ar';;
33 azerbaijani) langcode='az';;
34 bangla) langcode='bn';;
35 belarusian_cyrillic) langcode='be';;
36 belarusian_latin) langcode='be@latin';;
37 bulgarian) langcode='bg';;
38 bosnian) langcode='bs';;
39 catalan) langcode='ca';;
40 czech) langcode='cs';;
41 danish) langcode='da';;
42 german) langcode='de';;
43 greek) langcode='el';;
44 english) langcode='en';;
45 english-gb) langcode='en_GB';;
46 spanish) langcode='es';;
47 estonian) langcode='et';;
48 basque) langcode='eu';;
49 persian) langcode='fa';;
50 finnish) langcode='fi';;
51 french) langcode='fr';;
52 galician) langcode='gl';;
53 hebrew) langcode='he';;
54 hindi) langcode='hi';;
55 croatian) langcode='hr';;
56 hungarian) langcode='hu';;
57 indonesian) langcode='id';;
58 italian) langcode='it';;
59 japanese) langcode='ja';;
60 korean) langcode='ko';;
61 georgian) langcode='ka';;
62 lithuanian) langcode='lt';;
63 latvian) langcode='lv';;
64 macedonian_cyrillic) langcode='mk';;
65 mongolian) langcode='mn';;
66 malay) langcode='ms';;
67 dutch) langcode='nl';;
68 norwegian) langcode='nb';;
69 polish) langcode='pl';;
70 brazilian_portuguese) langcode='pt_BR';;
71 portuguese) langcode='pt';;
72 romanian) langcode='ro';;
73 russian) langcode='ru';;
74 sinhala) langcode='si';;
75 slovak) langcode='sk';;
76 slovenian) langcode='sl';;
77 albanian) langcode='sq';;
78 serbian_latin) langcode='sr@latin';;
79 serbian_cyrillic) langcode='sr';;
80 swedish) langcode='sv';;
81 thai) langcode='th';;
82 turkish) langcode='tr';;
83 tatarish) langcode='tt';;
84 ukrainian) langcode='uk';;
85 chinese_traditional) langcode='zh_TW';;
86 chinese_simplified) langcode='zh_CN';;
87 uzbek_cyrillic) langcode='uz';;
88 uzbek_latin) langcode='uz@latin';;
89 *) echo "Wrong loc: $loc"; exit 1;;
90 esac
92 echo "$loc -> $langcode"
93 if [ $langcode = en ] ; then
94 php2po -i po/english.php -o po/phpmyadmin-update.pot -P
95 sed -i '
96 s/PACKAGE VERSION/phpMyAdmin 3.4/;
97 s/Report-Msgid-Bugs-To: .*\\n/Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\\n/;
98 ' po/phpmyadmin-update.pot
99 else
100 php2po -t po/english.php -i po/$loc.php -o po/$langcode-update.po
101 sed -i "
102 s/PACKAGE VERSION/phpMyAdmin 3.4/;
103 /, fuzzy/D;
104 s/LANGUAGE <LL@li.org>/$loc <$langcode@li.org>/;
105 s/YEAR-MO-DA HO:MI+ZONE/`date +'%Y-%m-%d %H:%M%z'`/;
106 s/FULL NAME <EMAIL@ADDRESS>/Automatically generated/;
107 s/Report-Msgid-Bugs-To: .*\\\\n/Report-Msgid-Bugs-To: phpmyadmin-devel@lists.sourceforge.net\\\\n/;
108 " po/$langcode-update.po
109 ./scripts/mergepo.py po/$langcode.po po/$langcode-update.po
110 msgmerge -U -C po/$langcode-update.po po/$langcode.po po/phpmyadmin.pot
111 rm po/$langcode-update.po po/$loc.php
113 done
114 rm po/english.php po/phpmyadmin-update.pot