Reduce mapc dependences (need to split image.[ch])
[neverball] / share / i18n.c
index 5c8f1c4..2e3f23c 100644 (file)
@@ -1,9 +1,25 @@
+/*
+ * Copyright (C) 2006 Jean Privat
+ * Part of the Neverball Project http://icculus.org/neverball/
+ *
+ * NEVERBALL is  free software; you can redistribute  it and/or modify
+ * it under the  terms of the GNU General  Public License as published
+ * by the Free  Software Foundation; either version 2  of the License,
+ * or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
+ * MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
+ * General Public License for more details.
+ */
 
 #include <string.h>
 #include <locale.h>
 #include <stdlib.h>
 #include "i18n.h"
 
+/* predeclare the POSIX putenv function, I do not know why but is not declared */
+int putenv(char *string);
 
 const char * gettextdbg(const char * c)
 {
@@ -12,6 +28,20 @@ const char * gettextdbg(const char * c)
        return c;
 }
 
+const char * sgettext(const char *msgid)
+{
+    const char *msgval = gettext (msgid);
+    if (msgval == msgid) {
+       msgval = strrchr (msgid, '^');
+           if (msgval == NULL)
+                msgval = msgid;
+          else
+                msgval++;
+    }
+    return msgval;
+}
+
+
 /*---------------------------------------------------------------------------*/
 
 #define LANG_NUMBER 4