]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - locale/make-php-trans.awk
New file: locale/Makefile to replace locale/translate.sh
[SourceForge/phpwiki.git] / locale / make-php-trans.awk
1 BEGIN {
2   msgid=""; msgstr="";
3   print ("<?php\n");
4 }
5
6 /^msgid ""/ {
7   if (msgid && str)
8     print ("$locale[\"" msgid "\"] =\n   \"" str "\";");
9   str="";
10   next;
11 }
12
13 /^msgid "/ { #"{
14   if (msgid && str)
15     print ("$locale[\"" msgid "\"] =\n   \"" str "\";");
16   str = substr ($0, 8, length ($0) - 8);
17   msgstr="";
18 }
19
20 /^msgstr ""/ {
21   msgid=str;
22   str="";
23   next;
24 }
25
26 /^msgstr "/ { #"{
27   msgid=str;
28   str = substr ($0, 9, length ($0) - 9);
29   next;
30 }
31
32 /^"/ { #"{
33   str = (str substr ($0, 2, length ($0) - 2));
34   next;
35 }
36
37 END {
38   if (msgid && str)
39     print ("$locale[\"" msgid "\"] =\n   \"" str "\";");
40   print ("\n;?>");
41 }
42