Another strong code change. This one focusses Set management:
[neverball] / share / i18n.c
index 1736bd2..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,11 +28,25 @@ 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 3
-const char * language_names[] = {N_("English"), N_("French"), N_("Latvian")};
-const char * language_codes[] = {"en", "fr", "lv"};
+#define LANG_NUMBER 4
+const char * language_names[] = {N_("English"), N_("French"), N_("German"), N_("Latvian")};
+const char * language_codes[] = {"en", "fr", "de", "lv"};
 
 /*---------------------------------------------------------------------------*/
 
@@ -54,7 +84,7 @@ int language_count(void)
 int language_from_code(const char * code)
 {
     int i;
-    for(i=0; i<=LANG_NUMBER; i++)
+    for(i=0; i<LANG_NUMBER; i++)
            if (strcmp(language_codes[i], code) == 0)
                    return i+1;
     return 0;