00001 /* strerror-pr29.c --- Convert PR29 errors into text. 00002 * Copyright (C) 2004 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 the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * GNU Libidn is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with GNU Libidn; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00019 * 00020 */ 00021 00022 #if HAVE_CONFIG_H 00023 # include "config.h" 00024 #endif 00025 00026 #include "pr29.h" 00027 00028 #include "gettext.h" 00029 #define _(String) dgettext (PACKAGE, String) 00030 00048 const char * 00049 pr29_strerror (Pr29_rc rc) 00050 { 00051 const char *p; 00052 00053 bindtextdomain (PACKAGE, LOCALEDIR); 00054 00055 switch (rc) 00056 { 00057 case PR29_SUCCESS: 00058 p = _("Success"); 00059 break; 00060 00061 case PR29_PROBLEM: 00062 p = _("String not idempotent under Unicode NFKC normalization"); 00063 break; 00064 00065 case PR29_STRINGPREP_ERROR: 00066 p = _("String preparation failed"); 00067 break; 00068 00069 default: 00070 p = _("Unknown error"); 00071 break; 00072 } 00073 00074 return p; 00075 }