1 /* Message translation initialization for English.
2 Copyright (C) 2001-2003 Free Software Foundation, Inc.
3 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19
20 #ifdef HAVE_CONFIG_H
21 # include "config.h"
22 #endif
23
24 /* Specification. */
25 #include "msgl-english.h"
26
27 #include <string.h>
28
29 #include "xalloc.h"
30
31
32 msgdomain_list_ty *
msgdomain_list_english(msgdomain_list_ty * mdlp)33 msgdomain_list_english (msgdomain_list_ty *mdlp)
34 {
35 size_t j, k;
36
37 for (k = 0; k < mdlp->nitems; k++)
38 {
39 message_list_ty *mlp = mdlp->item[k]->messages;
40
41 for (j = 0; j < mlp->nitems; j++)
42 {
43 message_ty *mp = mlp->item[j];
44
45 if (mp->msgid_plural == NULL)
46 {
47 if (mp->msgstr_len == 1 && mp->msgstr[0] == '\0')
48 {
49 mp->msgstr = mp->msgid; /* no need for xstrdup */
50 mp->msgstr_len = strlen (mp->msgid) + 1;
51 }
52 }
53 else
54 {
55 if (mp->msgstr_len == 2
56 && mp->msgstr[0] == '\0' && mp->msgstr[1] == '\0')
57 {
58 size_t len0 = strlen (mp->msgid) + 1;
59 size_t len1 = strlen (mp->msgid_plural) + 1;
60 char *cp = (char *) xmalloc (len0 + len1);
61 memcpy (cp, mp->msgid, len0);
62 memcpy (cp + len0, mp->msgid_plural, len1);
63 mp->msgstr = cp;
64 mp->msgstr_len = len0 + len1;
65 }
66 }
67 }
68 }
69
70 return mdlp;
71 }
72