Index: common/fcintl.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/fcintl.c,v retrieving revision 1.3 diff -u -r1.3 fcintl.c --- common/fcintl.c 2002/02/11 10:38:01 1.3 +++ common/fcintl.c 2002/02/21 17:21:49 @@ -15,7 +15,9 @@ #endif #include +#include +#include "shared.h" #include "fcintl.h" /********************************************************************** @@ -46,4 +48,39 @@ } else { return (char*)str; /* may be something wrong */ } +} + +char *my_gettext(char *file, int line, const char *const string) +{ + char *trans = gettext(string); + + if ((strcmp("citydlg.c", file) == 0 || + strcmp("cma_fe.c", file) == 0 || + strcmp("gui_stuff.c", file) == 0 || + strcmp("happiness.c", file) == 0 || + strcmp("wldlg.c", file) == 0) && strcmp(string, trans) != 0) { + trans = strdup(trans); + + if (FALSE) { + printf("%s:%d\n", file, line); + printf(" %3d orig = '%s'\n", strlen(string), string); + printf(" %3d trans = '%s'\n", strlen(trans), trans); + } + + if (strlen(trans) > strlen(string)) { + printf("%3d MARK '%s'\n", strlen(trans) - strlen(string), string); + } + + if (FALSE) { + int len = MIN(strlen(trans), strlen(string)); + + if (string[strlen(string) - 1] == '\n') + trans[len - 1] = '\n'; + else + trans[len - 1] = '#'; + trans[len] = '\0'; + printf(" %3d trans' = '%s'\n", strlen(trans), trans); + } + } + return trans; } Index: common/fcintl.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/fcintl.h,v retrieving revision 1.8 diff -u -r1.8 fcintl.h --- common/fcintl.h 2002/01/14 17:17:16 1.8 +++ common/fcintl.h 2002/02/21 17:21:49 @@ -26,7 +26,8 @@ #include #endif -#define _(String) gettext(String) +char *my_gettext(char *file, int line, const char *const string); +#define _(String) my_gettext(__FILE__,__LINE__,String) #define N_(String) String #define Q_(String) skip_intl_qualifier_prefix(gettext(String)) #define PL_(String1, String2, n) ngettext((String1), (String2), (n))