Преглед изворни кода

Allow scripts to specify translation domain

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@40727 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements пре 15 година
родитељ
комит
c1d48e1e4b
1 измењених фајлова са 13 додато и 1 уклоњено
  1. 13 1
      general/g.parser/main.c

+ 13 - 1
general/g.parser/main.c

@@ -51,12 +51,24 @@ int translate_output = 0;
    If global variable to output strings for translation is set it spits them out */
    If global variable to output strings for translation is set it spits them out */
 char *translate(const char *arg)
 char *translate(const char *arg)
 {
 {
+    static const char *domain;
+
     if (*arg && translate_output) {
     if (*arg && translate_output) {
 	fputs(arg, stdout);
 	fputs(arg, stdout);
 	fputs("\n", stdout);
 	fputs("\n", stdout);
     }
     }
 
 
-    return _(arg);
+#if defined(HAVE_LIBINTL_H) && defined(USE_NLS)
+    if (!domain) {
+	domain = getenv("GRASS_TRANSLATION_DOMAIN");
+	if (!domain)
+	    domain = PACKAGE;
+    }
+
+    return G_gettext(domain, arg);
+#else
+    return arg;
+#endif
 }
 }
 
 
 static void parse_toplevel(struct context *ctx, const char *cmd)
 static void parse_toplevel(struct context *ctx, const char *cmd)