1 /* Message translation initialization for English.
2 Copyright (C) 2001-2003, 2006 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 3 of the License, or
8 (at your option) 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, see <https://www.gnu.org/licenses/>. */
17
18
19 #ifdef HAVE_CONFIG_H
20 # include "config.h"
21 #endif
22
23 /* Specification. */
24 #include "msgl-english.h"
25
26 #include <string.h>
27
28 #include "xalloc.h"
29
30
31 msgdomain_list_ty *
msgdomain_list_english(msgdomain_list_ty * mdlp)32 msgdomain_list_english (msgdomain_list_ty *mdlp)
33 {
34 size_t j, k;
35
36 for (k = 0; k < mdlp->nitems; k++)
37 {
38 message_list_ty *mlp = mdlp->item[k]->messages;
39
40 for (j = 0; j < mlp->nitems; j++)
41 {
42 message_ty *mp = mlp->item[j];
43
44 if (mp->msgid_plural == NULL)
45 {
46 if (mp->msgstr_len == 1 && mp->msgstr[0] == '\0')
47 {
48 mp->msgstr = mp->msgid; /* no need for xstrdup */
49 mp->msgstr_len = strlen (mp->msgid) + 1;
50 }
51 }
52 else
53 {
54 if (mp->msgstr_len == 2
55 && mp->msgstr[0] == '\0' && mp->msgstr[1] == '\0')
56 {
57 size_t len0 = strlen (mp->msgid) + 1;
58 size_t len1 = strlen (mp->msgid_plural) + 1;
59 char *cp = XNMALLOC (len0 + len1, char);
60 memcpy (cp, mp->msgid, len0);
61 memcpy (cp + len0, mp->msgid_plural, len1);
62 mp->msgstr = cp;
63 mp->msgstr_len = len0 + len1;
64 }
65 }
66 }
67 }
68
69 return mdlp;
70 }
71