|
libidn
1.25
|
00001 /* strerror-idna.c --- Convert IDNA errors into text. 00002 Copyright (C) 2004-2012 Simon Josefsson 00003 00004 This file is part of GNU Libidn. 00005 00006 GNU Libidn is free software: you can redistribute it and/or 00007 modify it under the terms of either: 00008 00009 * the GNU Lesser General Public License as published by the Free 00010 Software Foundation; either version 3 of the License, or (at 00011 your option) any later version. 00012 00013 or 00014 00015 * the GNU General Public License as published by the Free 00016 Software Foundation; either version 2 of the License, or (at 00017 your option) any later version. 00018 00019 or both in parallel, as here. 00020 00021 GNU Libidn is distributed in the hope that it will be useful, 00022 but WITHOUT ANY WARRANTY; without even the implied warranty of 00023 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00024 General Public License for more details. 00025 00026 You should have received copies of the GNU General Public License and 00027 the GNU Lesser General Public License along with this program. If 00028 not, see <http://www.gnu.org/licenses/>. */ 00029 00030 #ifdef HAVE_CONFIG_H 00031 # include "config.h" 00032 #endif 00033 00034 #include "idna.h" 00035 00036 #include "gettext.h" 00037 #define _(String) dgettext (PACKAGE, String) 00038 00072 const char * 00073 idna_strerror (Idna_rc rc) 00074 { 00075 const char *p; 00076 00077 bindtextdomain (PACKAGE, LOCALEDIR); 00078 00079 switch (rc) 00080 { 00081 case IDNA_SUCCESS: 00082 p = _("Success"); 00083 break; 00084 00085 case IDNA_STRINGPREP_ERROR: 00086 p = _("String preparation failed"); 00087 break; 00088 00089 case IDNA_PUNYCODE_ERROR: 00090 p = _("Punycode failed"); 00091 break; 00092 00093 case IDNA_CONTAINS_NON_LDH: 00094 p = _("Non-digit/letter/hyphen in input"); 00095 break; 00096 00097 case IDNA_CONTAINS_MINUS: 00098 p = _("Forbidden leading or trailing minus sign (`-')"); 00099 break; 00100 00101 case IDNA_INVALID_LENGTH: 00102 p = _("Output would be too large or too small"); 00103 break; 00104 00105 case IDNA_NO_ACE_PREFIX: 00106 p = _("Input does not start with ACE prefix (`xn--')"); 00107 break; 00108 00109 case IDNA_ROUNDTRIP_VERIFY_ERROR: 00110 p = _("String not idempotent under ToASCII"); 00111 break; 00112 00113 case IDNA_CONTAINS_ACE_PREFIX: 00114 p = _("Input already contain ACE prefix (`xn--')"); 00115 break; 00116 00117 case IDNA_ICONV_ERROR: 00118 p = _("System iconv failed"); 00119 break; 00120 00121 case IDNA_MALLOC_ERROR: 00122 p = _("Cannot allocate memory"); 00123 break; 00124 00125 case IDNA_DLOPEN_ERROR: 00126 p = _("System dlopen failed"); 00127 break; 00128 00129 default: 00130 p = _("Unknown error"); 00131 break; 00132 } 00133 00134 return p; 00135 }
1.7.6.1