Commit 5eccd26d5411c58e052afd503bd877eb5ac7a74b

Authored by Perry Werneck
1 parent c372005a

Atualizando criação dos arquivos de tradução.

.gitignore
1 1 .bin
2 2 .tmp
3 3 .obj
  4 +.pot
4 5 *~
5 6 *.log
6 7 *.status
... ... @@ -17,6 +18,7 @@
17 18 *.png
18 19 *.zip
19 20 *.ico
  21 +*.pot
20 22 *.[0-9]
21 23 versions
22 24 ChangeLog*
... ...
Makefile.in
... ... @@ -58,6 +58,7 @@ INSTALL=@INSTALL@
58 58 INSTALL_DATA=@INSTALL_DATA@
59 59 INSTALL_PROGRAM=@INSTALL_PROGRAM@
60 60 MKDIR=@MKDIR_P@
  61 +MSGCAT=@MSGCAT@
61 62  
62 63 #---[ Rules ]------------------------------------------------------------------
63 64  
... ... @@ -119,9 +120,15 @@ Release: \
119 120 $(BINRLS)/$(PACKAGE_TARNAME)@EXEEXT@
120 121  
121 122 pot: \
  123 + $(PACKAGE_TARNAME).pot
  124 +
  125 +$(PACKAGE_TARNAME).pot: \
122 126 $(POTDIR)/lib3270.pot \
123 127 $(POTDIR)/pw3270.pot
124 128  
  129 + @rm -f $@
  130 + @mkdir -p `dirname $@`
  131 + @$(MSGCAT) --sort-output $^ > $@
125 132  
126 133 install: \
127 134 $(DESTDIR)$(libdir)/lib3270@DLLEXT@ \
... ...
src/lib3270/Makefile.in
... ... @@ -106,7 +106,7 @@ $(OBJRLS)/%.o: \
106 106  
107 107 $(POTDIR)/%.pot: %.c
108 108  
109   - @echo $< ...
  109 + @echo $(notdir $@) ...
110 110 @$(MKDIR) `dirname $@`
111 111 @$(XGETTEXT) \
112 112 --default-domain=$(PACKAGE) \
... ...
src/pw3270/Makefile.in
... ... @@ -118,7 +118,7 @@ $(OBJRLS)/%.o: \
118 118  
119 119 $(POTDIR)/%.pot: %.c
120 120  
121   - @echo $< ...
  121 + @echo $(notdir $@) ...
122 122 @$(MKDIR) `dirname $@`
123 123 @$(XGETTEXT) \
124 124 --default-domain=$(PACKAGE) \
... ...
src/pw3270/common/Makefile.in
... ... @@ -85,7 +85,7 @@ $(OBJRLS)/%.o: \
85 85  
86 86 $(POTDIR)/%.pot: %.c
87 87  
88   - @echo $< ...
  88 + @$(notdir $@) ...
89 89 @$(MKDIR) `dirname $@`
90 90 @$(XGETTEXT) \
91 91 --default-domain=$(PACKAGE) \
... ...
src/pw3270/uiparser/Makefile.in
... ... @@ -87,7 +87,7 @@ $(OBJRLS)/%.o: \
87 87  
88 88 $(POTDIR)/%.pot: %.c
89 89  
90   - @echo $< ...
  90 + @echo $(notdir $@) ...
91 91 @$(MKDIR) `dirname $@`
92 92 @$(XGETTEXT) \
93 93 --default-domain=$(PACKAGE) \
... ...
src/pw3270/v3270/Makefile.in
... ... @@ -87,7 +87,7 @@ $(OBJRLS)/%.o: \
87 87  
88 88 $(POTDIR)/%.pot: %.c
89 89  
90   - @echo $< ...
  90 + @echo $(notdir $@) ...
91 91 @$(MKDIR) `dirname $@`
92 92 @$(XGETTEXT) \
93 93 --default-domain=$(PACKAGE) \
... ...
src/pw3270/v3270ft/Makefile.in
... ... @@ -87,7 +87,7 @@ $(OBJRLS)/%.o: \
87 87  
88 88 $(POTDIR)/%.pot: %.c
89 89  
90   - @echo $< ...
  90 + @echo $(notdir $@) ...
91 91 @$(MKDIR) `dirname $@`
92 92 @$(XGETTEXT) \
93 93 --default-domain=$(PACKAGE) \
... ...
src/tools/xml2pot.c
... ... @@ -1,184 +0,0 @@
1   -/*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
16   - *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
19   - * Place, Suite 330, Boston, MA, 02111-1307, USA
20   - *
21   - * Este programa está nomeado como xml2pot.c e possui - linhas de código.
22   - *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27   - * licinio@bb.com.br (Licínio Luis Branco)
28   - * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
29   - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
30   - *
31   - */
32   -
33   -#include <stdlib.h>
34   -#include <stdio.h>
35   -#include <glib.h>
36   -#include <string.h>
37   -
38   - static const gchar *filename = NULL;
39   - static FILE *out;
40   - static GHashTable *hash = NULL;
41   -
42   - struct record
43   - {
44   - const gchar *filename;
45   - const gchar *label;
46   - gint line_number;
47   - gint char_number;
48   -
49   - gchar text[1];
50   - };
51   -
52   -/*---[ Implement ]----------------------------------------------------------------------------------------*/
53   -
54   - static void element_start(GMarkupParseContext *context,const gchar *element_name,const gchar **names,const gchar **values, gpointer user_data, GError **error)
55   - {
56   - int f;
57   -
58   - for(f=0;names[f];f++)
59   - {
60   - if(!strcmp(names[f],"label") && values[f])
61   - {
62   - struct record *rec = g_hash_table_lookup(hash,values[f]);
63   -
64   - if(!rec)
65   - {
66   - struct record *rec = g_malloc0(sizeof(struct record)+strlen(values[f])+strlen(filename)+3);
67   - char *ptr = rec->text;
68   -
69   - g_markup_parse_context_get_position(context,&rec->line_number,&rec->char_number);
70   -
71   - strcpy(ptr,filename);
72   - rec->filename = ptr;
73   - ptr += (strlen(ptr)+1);
74   -
75   - strcpy(ptr,values[f]);
76   - rec->label = ptr;
77   -
78   - g_hash_table_insert(hash,(gpointer) rec->label, rec);
79   - }
80   - }
81   - }
82   -
83   - }
84   -
85   - static void element_end(GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error)
86   - {
87   - }
88   -
89   - static void element_text(GMarkupParseContext *context,const gchar *text,gsize text_len, gpointer user_data, GError **error)
90   - {
91   - }
92   -
93   - static void element_passthrough(GMarkupParseContext *context,const gchar *passthrough_text, gsize text_len, gpointer user_data,GError **error)
94   - {
95   - }
96   -
97   - static void element_error(GMarkupParseContext *context,GError *error,gpointer user_data)
98   - {
99   - }
100   -
101   - static const GMarkupParser parser =
102   - {
103   - element_start,
104   - element_end,
105   - element_text,
106   - element_passthrough,
107   - element_error,
108   - };
109   -
110   - static int parsefile(GMarkupParseContext *context)
111   - {
112   - GError *error = NULL;
113   - gchar *contents = NULL;
114   -
115   - if(!g_file_get_contents(filename,&contents,NULL,&error))
116   - {
117   - fprintf(stderr,"%s\n",error->message);
118   - g_error_free(error);
119   - return -1;
120   - }
121   -
122   - if(!g_markup_parse_context_parse(context,contents,strlen(contents),&error))
123   - {
124   - fprintf(stderr,"%s\n",error->message);
125   - g_error_free(error);
126   - g_free(contents);
127   - return -1;
128   - }
129   -
130   - g_free(contents);
131   - return 0;
132   - }
133   -
134   - static void write_file(gpointer key,struct record *rec, FILE *out)
135   - {
136   - fprintf(out,"#: %s:%d\n",rec->filename,(int) rec->line_number);
137   - fprintf(out,"msgid \"%s\"\n",rec->label);
138   - fprintf(out,"msgstr \"\"\n\n");
139   - }
140   -
141   - int main (int argc, char *argv[])
142   - {
143   - static const char * header= "# SOME DESCRIPTIVE TITLE.\n"
144   - "# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n"
145   - "# This file is distributed under the same license as the PACKAGE package.\n"
146   - "# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n"
147   - "#\n"
148   - "#, fuzzy\n"
149   - "msgid \"\"\n"
150   - "msgstr \"\"\n"
151   - "\"Project-Id-Version: PACKAGE VERSION\\n\"\n"
152   - "\"Report-Msgid-Bugs-To: \\n\"\n"
153   - "\"POT-Creation-Date: 2010-01-18 17:12-0200\\n\"\n"
154   - "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"
155   - "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n"
156   - "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n"
157   - "\"Language: \\n\"\n"
158   - "\"MIME-Version: 1.0\\n\"\n"
159   - "\"Content-Type: text/plain; charset=CHARSET\\n\"\n"
160   - "\"Content-Transfer-Encoding: 8bit\\n\"\n\n";
161   -
162   - int rc = 0;
163   - int f;
164   -
165   - GMarkupParseContext *context = g_markup_parse_context_new(&parser,G_MARKUP_TREAT_CDATA_AS_TEXT,NULL,NULL);
166   -
167   - out = stdout;
168   -
169   - fprintf(out,"%s",header);
170   -
171   - hash = g_hash_table_new(g_str_hash, g_str_equal);
172   -
173   - for(f=1;f<argc;f++)
174   - {
175   - filename = argv[f];
176   - rc = parsefile(context);
177   - }
178   -
179   - g_hash_table_foreach(hash,(GHFunc) write_file, out);
180   -
181   -
182   - return rc;
183   - }
184   -
ui/xml2pot.c 0 → 100644
... ... @@ -0,0 +1,184 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
  19 + * Place, Suite 330, Boston, MA, 02111-1307, USA
  20 + *
  21 + * Este programa está nomeado como xml2pot.c e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda)
  30 + *
  31 + */
  32 +
  33 +#include <stdlib.h>
  34 +#include <stdio.h>
  35 +#include <glib.h>
  36 +#include <string.h>
  37 +
  38 + static const gchar *filename = NULL;
  39 + static FILE *out;
  40 + static GHashTable *hash = NULL;
  41 +
  42 + struct record
  43 + {
  44 + const gchar *filename;
  45 + const gchar *label;
  46 + gint line_number;
  47 + gint char_number;
  48 +
  49 + gchar text[1];
  50 + };
  51 +
  52 +/*---[ Implement ]----------------------------------------------------------------------------------------*/
  53 +
  54 + static void element_start(GMarkupParseContext *context,const gchar *element_name,const gchar **names,const gchar **values, gpointer user_data, GError **error)
  55 + {
  56 + int f;
  57 +
  58 + for(f=0;names[f];f++)
  59 + {
  60 + if(!strcmp(names[f],"label") && values[f])
  61 + {
  62 + struct record *rec = g_hash_table_lookup(hash,values[f]);
  63 +
  64 + if(!rec)
  65 + {
  66 + struct record *rec = g_malloc0(sizeof(struct record)+strlen(values[f])+strlen(filename)+3);
  67 + char *ptr = rec->text;
  68 +
  69 + g_markup_parse_context_get_position(context,&rec->line_number,&rec->char_number);
  70 +
  71 + strcpy(ptr,filename);
  72 + rec->filename = ptr;
  73 + ptr += (strlen(ptr)+1);
  74 +
  75 + strcpy(ptr,values[f]);
  76 + rec->label = ptr;
  77 +
  78 + g_hash_table_insert(hash,(gpointer) rec->label, rec);
  79 + }
  80 + }
  81 + }
  82 +
  83 + }
  84 +
  85 + static void element_end(GMarkupParseContext *context, const gchar *element_name, gpointer user_data, GError **error)
  86 + {
  87 + }
  88 +
  89 + static void element_text(GMarkupParseContext *context,const gchar *text,gsize text_len, gpointer user_data, GError **error)
  90 + {
  91 + }
  92 +
  93 + static void element_passthrough(GMarkupParseContext *context,const gchar *passthrough_text, gsize text_len, gpointer user_data,GError **error)
  94 + {
  95 + }
  96 +
  97 + static void element_error(GMarkupParseContext *context,GError *error,gpointer user_data)
  98 + {
  99 + }
  100 +
  101 + static const GMarkupParser parser =
  102 + {
  103 + element_start,
  104 + element_end,
  105 + element_text,
  106 + element_passthrough,
  107 + element_error,
  108 + };
  109 +
  110 + static int parsefile(GMarkupParseContext *context)
  111 + {
  112 + GError *error = NULL;
  113 + gchar *contents = NULL;
  114 +
  115 + if(!g_file_get_contents(filename,&contents,NULL,&error))
  116 + {
  117 + fprintf(stderr,"%s\n",error->message);
  118 + g_error_free(error);
  119 + return -1;
  120 + }
  121 +
  122 + if(!g_markup_parse_context_parse(context,contents,strlen(contents),&error))
  123 + {
  124 + fprintf(stderr,"%s\n",error->message);
  125 + g_error_free(error);
  126 + g_free(contents);
  127 + return -1;
  128 + }
  129 +
  130 + g_free(contents);
  131 + return 0;
  132 + }
  133 +
  134 + static void write_file(gpointer key,struct record *rec, FILE *out)
  135 + {
  136 + fprintf(out,"#: %s:%d\n",rec->filename,(int) rec->line_number);
  137 + fprintf(out,"msgid \"%s\"\n",rec->label);
  138 + fprintf(out,"msgstr \"\"\n\n");
  139 + }
  140 +
  141 + int main (int argc, char *argv[])
  142 + {
  143 + static const char * header= "# SOME DESCRIPTIVE TITLE.\n"
  144 + "# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER\n"
  145 + "# This file is distributed under the same license as the PACKAGE package.\n"
  146 + "# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n"
  147 + "#\n"
  148 + "#, fuzzy\n"
  149 + "msgid \"\"\n"
  150 + "msgstr \"\"\n"
  151 + "\"Project-Id-Version: PACKAGE VERSION\\n\"\n"
  152 + "\"Report-Msgid-Bugs-To: \\n\"\n"
  153 + "\"POT-Creation-Date: 2010-01-18 17:12-0200\\n\"\n"
  154 + "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"\n"
  155 + "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"\n"
  156 + "\"Language-Team: LANGUAGE <LL@li.org>\\n\"\n"
  157 + "\"Language: \\n\"\n"
  158 + "\"MIME-Version: 1.0\\n\"\n"
  159 + "\"Content-Type: text/plain; charset=CHARSET\\n\"\n"
  160 + "\"Content-Transfer-Encoding: 8bit\\n\"\n\n";
  161 +
  162 + int rc = 0;
  163 + int f;
  164 +
  165 + GMarkupParseContext *context = g_markup_parse_context_new(&parser,G_MARKUP_TREAT_CDATA_AS_TEXT,NULL,NULL);
  166 +
  167 + out = stdout;
  168 +
  169 + fprintf(out,"%s",header);
  170 +
  171 + hash = g_hash_table_new(g_str_hash, g_str_equal);
  172 +
  173 + for(f=1;f<argc;f++)
  174 + {
  175 + filename = argv[f];
  176 + rc = parsefile(context);
  177 + }
  178 +
  179 + g_hash_table_foreach(hash,(GHFunc) write_file, out);
  180 +
  181 +
  182 + return rc;
  183 + }
  184 +
... ...