Skip to contentSkip to conversation

mkfs.gfs2: Add gettext support

Cluster-devel Steven Whitehouse 1 participant 1 message Mar 23, 2009

lore
Share & tools
lore
#0 lore raw

From 770f813b787ce5c3ae2cbf56cd16d6ad824e04da Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[email protected]>
Date: Mon, 23 Mar 2009 17:04:13 +0000
Subject: [PATCH] mkfs.gfs2: Add gettext support

Same as for gfs2_tool. I hope that by adding the markup for gettext it will encourage better English by making people think a bit about how the message would need to be translated as well as paving the way for later translations.

---
 gfs2/mkfs/main.c      |    9 ++-
 gfs2/mkfs/main_grow.c |   46 ++++++++-------
 gfs2/mkfs/main_jadd.c |  135 ++++++++++++++++++++----------------------
 gfs2/mkfs/main_mkfs.c |  157 ++++++++++++++++++++++++-------------------------
 4 files changed, 172 insertions(+), 175 deletions(-)
gfs2/mkfs/main.c +7 -2
index 9471c6f..1e9d225 100644
@@ -10,6 +10,8 @@
 #include <time.h>
 #include <errno.h>
 #include <libgen.h>
+#include <libintl.h>
+#define _(String) gettext(String)
 
 #include <linux/types.h>
 #include "libgfs2.h"
@@ -30,6 +32,9 @@ main(int argc, char *argv[])
 {
 	char *p, *whoami;
 
+	setlocale(LC_ALL, "");
+	textdomain("mkfs.gfs2");
+
 	prog_name = argv[0];
 	srandom(time(NULL) ^ getpid());
 
@@ -43,9 +48,9 @@ main(int argc, char *argv[])
 	else if (!strcmp(whoami, "gfs2_grow"))
 		main_grow(argc, argv);
 	else
-		die("I don't know who I am!\n");
+		die( _("I don't know who I am!\n"));
 
 	free(p);
 
-	return EXIT_SUCCESS;
+	return 0;
 }
gfs2/mkfs/main_grow.c +24 -22

135 lines not on this page · raw message

gfs2/mkfs/main_jadd.c +64 -71

357 lines not on this page · raw message

gfs2/mkfs/main_mkfs.c +77 -80

366 lines not on this page · raw message

Signature · 1 line
1.6.0.6