]> git.meshlink.io Git - catta/blob - avahi-common/error.c
add i18n support
[catta] / avahi-common / error.c
1 /* $Id$ */
2
3 /***
4   This file is part of avahi.
5
6   avahi is free software; you can redistribute it and/or modify it
7   under the terms of the GNU Lesser General Public License as
8   published by the Free Software Foundation; either version 2.1 of the
9   License, or (at your option) any later version.
10
11   avahi is distributed in the hope that it will be useful, but WITHOUT
12   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
14   Public License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with avahi; if not, write to the Free Software
18   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19   USA.
20  ***/
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include "error.h"
27 #include "i18n.h"
28
29 const char *avahi_strerror(int error) {
30
31     const char * const msg[- AVAHI_ERR_MAX] = {
32         N_("OK"),
33         N_("Operation failed"),
34         N_("Bad state"),
35         N_("Invalid host name"),
36         N_("Invalid domain name"),
37         N_("No suitable network protocol available"),
38         N_("Invalid DNS TTL"),
39         N_("Resource record key is pattern"),
40         N_("Local name collision"),
41         N_("Invalid record"),
42
43         N_("Invalid service name"),
44         N_("Invalid service type"),
45         N_("Invalid port number"),
46         N_("Invalid record key"),
47         N_("Invalid address"),
48         N_("Timeout reached"),
49         N_("Too many clients"),
50         N_("Too many objects"),
51         N_("Too many entries"),
52         N_("OS Error"),
53
54         N_("Access denied"),
55         N_("Invalid operation"),
56         N_("An unexpected D-Bus error occured"),
57         N_("Daemon connection failed"),
58         N_("Memory exhausted"),
59         N_("The object passed in was not valid"),
60         N_("Daemon not running"),
61         N_("Invalid interface index"),
62         N_("Invalid protocol specification"),
63         N_("Invalid flags"),
64
65         N_("Not found"),
66         N_("Invalid configuration"),
67         N_("Version mismatch"),
68         N_("Invalid service subtype"),
69         N_("Invalid packet"),
70         N_("Invalid DNS return code"),
71         N_("DNS failure: FORMERR"),
72         N_("DNS failure: SERVFAIL"),
73         N_("DNS failure: NXDOMAIN"),
74         N_("DNS failure: NOTIMP"),
75
76         N_("DNS failure: REFUSED"),
77         N_("DNS failure: YXDOMAIN"),
78         N_("DNS failure: YXRRSET"),
79         N_("DNS failure: NXRRSET"),
80         N_("DNS failure: NOTAUTH"),
81         N_("DNS failure: NOTZONE"),
82         N_("Invalid RDATA"),
83         N_("Invalid DNS type"),
84         N_("Invalid DNS class"),
85         N_("Not supported"),
86
87         N_("Not permitted"),
88         N_("Invalid argument"),
89         N_("Is empty"),
90         N_("The requested operation is invalid because redundant")
91     };
92
93     avahi_init_i18n();
94
95     if (-error < 0 || -error >= -AVAHI_ERR_MAX)
96         return _("Invalid Error Code");
97
98     return _(msg[-error]);
99 }