| 1 | /* Copyright (C) 2005-2012 by George Williams */ |
| 2 | /* |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are met: |
| 5 | |
| 6 | * Redistributions of source code must retain the above copyright notice, this |
| 7 | * list of conditions and the following disclaimer. |
| 8 | |
| 9 | * Redistributions in binary form must reproduce the above copyright notice, |
| 10 | * this list of conditions and the following disclaimer in the documentation |
| 11 | * and/or other materials provided with the distribution. |
| 12 | |
| 13 | * The name of the author may not be used to endorse or promote products |
| 14 | * derived from this software without specific prior written permission. |
| 15 | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
| 19 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #ifndef FONTFORGE_INTL_H |
| 29 | #define FONTFORGE_INTL_H |
| 30 | |
| 31 | #include <fontforge-config.h> |
| 32 | |
| 33 | #if !defined( HAVE_LIBINTL_H ) |
| 34 | |
| 35 | # define _(str) (str) |
| 36 | # define P_(str1,str_non1,n) ((n)==1?str1:str_non1) |
| 37 | # define U_(str) (str) |
| 38 | |
| 39 | # ifdef bindtextdomain |
| 40 | # undef bindtextdomain |
| 41 | # endif |
| 42 | # ifdef bind_textdomain_codeset |
| 43 | # undef bind_textdomain_codeset |
| 44 | # endif |
| 45 | # ifdef textdomain |
| 46 | # undef textdomain |
| 47 | # endif |
| 48 | |
| 49 | # define bindtextdomain(domain,dir) |
| 50 | # define bind_textdomain_codeset(domain,enc) |
| 51 | # define textdomain(domain) |
| 52 | |
| 53 | # define dgettext(domain,str) (str) |
| 54 | |
| 55 | #else /* HAVE_LIBINTL_H */ |
| 56 | |
| 57 | # include <libintl.h> |
| 58 | # define _(str) gettext(str) |
| 59 | # define P_(str1,str_non1,n) ngettext(str1,str_non1,n) |
| 60 | /* For messages including utf8 characters. old xgettexts won't handle them */ |
| 61 | /* so we must do something special. */ |
| 62 | # define U_(str) gettext(str) |
| 63 | |
| 64 | #endif /* HAVE_LIBINTL_H */ |
| 65 | |
| 66 | /* For messages including utf8 sequences that need gettext_noop treatment */ |
| 67 | #define NU_(str) (str) |
| 68 | #define N_(str) (str) |
| 69 | #define S_(str) sgettext(str) |
| 70 | /* For messages in the shortcuts domain */ |
| 71 | #define H_(str) (str) |
| 72 | |
| 73 | #ifdef __cplusplus |
| 74 | extern "C" { |
| 75 | #endif |
| 76 | |
| 77 | char *sgettext(const char *msgid); |
| 78 | void gettext_locale(char *buffer, int size); |
| 79 | |
| 80 | #ifdef __cplusplus |
| 81 | } |
| 82 | #endif |
| 83 | |
| 84 | #endif /* FONTFORGE_INTL_H */ |