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