git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH/RFC 00/17] Begin gettextizing Git
@ 2010-08-30 21:28 Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls Ævar Arnfjörð Bjarmason
                   ` (19 more replies)
  0 siblings, 20 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Now that Git has the infrastructure for translation in next I'm going
to start submitting patches to make the main porcelain translatable.

This series starts that work, and fixes and also fixes up some of the
infrastructure (like the bug discussed in "Odd encoding issue with
UTF-8 + gettext yields ? on non-ASCII"), and adds tests to make sure
it's all working.

With it applied git-init is the one and only utility of the porcelain
that's translatable. The series includes a translation of it into
Icelandic and Polish.

I think it's ready to be applied. I tested it on Solaris, FreeBSD and
Debian. But there's almost definitely something I'm missing in a
series this big, so it's an RFC.

Marcin Cieślak (1):
  po/pl.po: add Polish translation

Ævar Arnfjörð Bjarmason (16):
  Makefile: A variable for options used by xgettext(1) calls
  Makefile: provide a --msgid-bugs-address to xgettext(1)
  Makefile: tell xgettext(1) that our source is in UTF-8
  builtin.h: Include gettext.h
  gettext: make the simple parts of git-init localizable
  gettext: localize the main git-init message
  gettext.c: work around us not using setlocale(LC_CTYPE, "")
  gettext tests: test if $VERSION exists before using it
  gettext tests: update test/is.po to match t/t0200/test.c
  gettext tests: add detection for is_IS.ISO-8859-1 locale
  gettext tests: test message re-encoding under Shell
  gettext tests: test re-encoding with a UTF-8 msgid under Shell
  gettext tests: mark a test message as not needing translation
  po/is.po: msgmerge and add Language: header
  po/is.po: add Icelandic translation
  gettext tests: test message re-encoding under C

 Makefile                           |    7 +-
 builtin.h                          |    1 +
 builtin/init-db.c                  |   56 ++++++-----
 gettext.c                          |    6 +
 po/is.po                           |  153 ++++++++++++++++++++++++++++--
 po/pl.po                           |  187 ++++++++++++++++++++++++++++++++++++
 t/lib-gettext.sh                   |   26 +++++-
 t/t0200-gettext-basic.sh           |    4 +-
 t/t0200/test.c                     |   10 ++
 t/t0202/test.pl                    |    4 +-
 t/t0204-gettext-reencode-sanity.sh |   78 +++++++++++++++
 11 files changed, 490 insertions(+), 42 deletions(-)
 create mode 100644 po/pl.po
 create mode 100755 t/t0204-gettext-reencode-sanity.sh

-- 
1.7.2.2.536.g3f548

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-31 14:51   ` Jonathan Nieder
  2010-08-30 21:28 ` [PATCH/RFC 02/17] Makefile: provide a --msgid-bugs-address to xgettext(1) Ævar Arnfjörð Bjarmason
                   ` (18 subsequent siblings)
  19 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change the Makefile code to use a variable for the options that all
the xgettext(1) invocations are using. This makes it more readable,
and makes it easier to add more standard options.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 62d526a..6a5bcf5 100644
--- a/Makefile
+++ b/Makefile
@@ -2008,10 +2008,11 @@ cscope:
 	$(RM) cscope*
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
+XGETTEXT_OPTIONS = --add-comments
 pot:
-	$(XGETTEXT) --add-comments --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
-	$(XGETTEXT) --add-comments --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
-	$(XGETTEXT) --add-comments --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
+	$(XGETTEXT) $(XGETTEXT_OPTIONS) --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
+	$(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
+	$(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
 
 POFILES := $(wildcard po/*.po)
 MOFILES := $(patsubst po/%.po,share/locale/%/LC_MESSAGES/git.mo,$(POFILES))
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 02/17] Makefile: provide a --msgid-bugs-address to xgettext(1)
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 03/17] Makefile: tell xgettext(1) that our source is in UTF-8 Ævar Arnfjörð Bjarmason
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change the invocations of xgettext to use the --msgid-bugs-address
option. This has the effect of adding a Report-Msgid-Bugs-To header to
the git.pot and the derived *.po files. Doing so is recommended by the
gettext manual.

If this isn't added the Report-Msgid-Bugs-To header already in
po/is.po and other PO files will be removed by msgmerge(1).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 6a5bcf5..4b46579 100644
--- a/Makefile
+++ b/Makefile
@@ -2008,7 +2008,7 @@ cscope:
 	$(RM) cscope*
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
-XGETTEXT_OPTIONS = --add-comments
+XGETTEXT_OPTIONS = --add-comments --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>"
 pot:
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 03/17] Makefile: tell xgettext(1) that our source is in UTF-8
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 02/17] Makefile: provide a --msgid-bugs-address to xgettext(1) Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 04/17] builtin.h: Include gettext.h Ævar Arnfjörð Bjarmason
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

By default xgettext(1) assumes that source code is in US-ASCII, change
that to UTF-8 for our case.

I'm not planning to include non-ASCII in any of the main Git interface
strings. But this'll be used for a gettext regression test to make
sure this works if we ever want to go this route, and to check that
the gettext implementation is sane in this regard.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 4b46579..9818a59 100644
--- a/Makefile
+++ b/Makefile
@@ -2008,7 +2008,7 @@ cscope:
 	$(RM) cscope*
 	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 
-XGETTEXT_OPTIONS = --add-comments --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>"
+XGETTEXT_OPTIONS = --add-comments --msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" --from-code=UTF-8
 pot:
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
 	$(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 04/17] builtin.h: Include gettext.h
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (2 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 03/17] Makefile: tell xgettext(1) that our source is in UTF-8 Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable Ævar Arnfjörð Bjarmason
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change builtin.h to include gettext.h. This is needed in order to
translate Git's builtin commands (like git-init), which don't include
gettext.h otherwise.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/builtin.h b/builtin.h
index ed6ee26..6cd3bd8 100644
--- a/builtin.h
+++ b/builtin.h
@@ -6,6 +6,7 @@
 #include "cache.h"
 #include "commit.h"
 #include "notes.h"
+#include "gettext.h"
 
 extern const char git_version_string[];
 extern const char git_usage_string[];
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (3 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 04/17] builtin.h: Include gettext.h Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:03   ` Jonathan Nieder
  2010-08-30 21:28 ` [PATCH/RFC 06/17] gettext: localize the main git-init message Ævar Arnfjörð Bjarmason
                   ` (14 subsequent siblings)
  19 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change the user visible strings in init-db.c to use gettext
localizations. This only converts messages which needed to be changed
from "foo" to _("foo"), and didn't need any TRANSLATORS comments.

I haven't marked the messages in init_db_usage or init_db_options for
translation, since that would require additional changes in
parse-options.c. Those can be done later.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/init-db.c |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 0271285..9c08985 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -31,7 +31,7 @@ static void safe_create_dir(const char *dir, int share)
 		}
 	}
 	else if (share && adjust_shared_perm(dir))
-		die("Could not make %s writable by group", dir);
+		die(_("Could not make %s writable by group"), dir);
 }
 
 static void copy_templates_1(char *path, int baselen,
@@ -58,25 +58,25 @@ static void copy_templates_1(char *path, int baselen,
 		namelen = strlen(de->d_name);
 		if ((PATH_MAX <= baselen + namelen) ||
 		    (PATH_MAX <= template_baselen + namelen))
-			die("insanely long template name %s", de->d_name);
+			die(_("insanely long template name %s"), de->d_name);
 		memcpy(path + baselen, de->d_name, namelen+1);
 		memcpy(template + template_baselen, de->d_name, namelen+1);
 		if (lstat(path, &st_git)) {
 			if (errno != ENOENT)
-				die_errno("cannot stat '%s'", path);
+				die_errno(_("cannot stat '%s'"), path);
 		}
 		else
 			exists = 1;
 
 		if (lstat(template, &st_template))
-			die_errno("cannot stat template '%s'", template);
+			die_errno(_("cannot stat template '%s'"), template);
 
 		if (S_ISDIR(st_template.st_mode)) {
 			DIR *subdir = opendir(template);
 			int baselen_sub = baselen + namelen;
 			int template_baselen_sub = template_baselen + namelen;
 			if (!subdir)
-				die_errno("cannot opendir '%s'", template);
+				die_errno(_("cannot opendir '%s'"), template);
 			path[baselen_sub++] =
 				template[template_baselen_sub++] = '/';
 			path[baselen_sub] =
@@ -93,20 +93,20 @@ static void copy_templates_1(char *path, int baselen,
 			int len;
 			len = readlink(template, lnk, sizeof(lnk));
 			if (len < 0)
-				die_errno("cannot readlink '%s'", template);
+				die_errno(_("cannot readlink '%s'"), template);
 			if (sizeof(lnk) <= len)
-				die("insanely long symlink %s", template);
+				die(_("insanely long symlink %s"), template);
 			lnk[len] = 0;
 			if (symlink(lnk, path))
-				die_errno("cannot symlink '%s' '%s'", lnk, path);
+				die_errno(_("cannot symlink '%s' '%s'"), lnk, path);
 		}
 		else if (S_ISREG(st_template.st_mode)) {
 			if (copy_file(path, template, st_template.st_mode))
-				die_errno("cannot copy '%s' to '%s'", template,
+				die_errno(_("cannot copy '%s' to '%s'"), template,
 					  path);
 		}
 		else
-			error("ignoring template %s", template);
+			error(_("ignoring template %s"), template);
 	}
 }
 
@@ -129,7 +129,7 @@ static void copy_templates(const char *template_dir)
 		return;
 	template_len = strlen(template_dir);
 	if (PATH_MAX <= (template_len+strlen("/config")))
-		die("insanely long template path %s", template_dir);
+		die(_("insanely long template path %s"), template_dir);
 	strcpy(template_path, template_dir);
 	if (template_path[template_len-1] != '/') {
 		template_path[template_len++] = '/';
@@ -137,7 +137,7 @@ static void copy_templates(const char *template_dir)
 	}
 	dir = opendir(template_path);
 	if (!dir) {
-		warning("templates not found %s", template_dir);
+		warning(_("templates not found %s"), template_dir);
 		return;
 	}
 
@@ -150,8 +150,8 @@ static void copy_templates(const char *template_dir)
 
 	if (repository_format_version &&
 	    repository_format_version != GIT_REPO_VERSION) {
-		warning("not copying templates of "
-			"a wrong format version %d from '%s'",
+		warning(_("not copying templates of "
+			"a wrong format version %d from '%s'"),
 			repository_format_version,
 			template_dir);
 		closedir(dir);
@@ -188,7 +188,7 @@ static int create_default_files(const char *template_path)
 	int filemode;
 
 	if (len > sizeof(path)-50)
-		die("insane git directory %s", git_dir);
+		die(_("insane git directory %s"), git_dir);
 	memcpy(path, git_dir, len);
 
 	if (len && path[len-1] != '/')
@@ -369,7 +369,7 @@ static int guess_repository_type(const char *git_dir)
 	if (!strcmp(".", git_dir))
 		return 1;
 	if (!getcwd(cwd, sizeof(cwd)))
-		die_errno("cannot tell cwd");
+		die_errno(_("cannot tell cwd"));
 	if (!strcmp(git_dir, cwd))
 		return 1;
 	/*
@@ -443,18 +443,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 					errno = EEXIST;
 					/* fallthru */
 				case -1:
-					die_errno("cannot mkdir %s", argv[0]);
+					die_errno(_("cannot mkdir %s"), argv[0]);
 					break;
 				default:
 					break;
 				}
 				shared_repository = saved;
 				if (mkdir(argv[0], 0777) < 0)
-					die_errno("cannot mkdir %s", argv[0]);
+					die_errno(_("cannot mkdir %s"), argv[0]);
 				mkdir_tried = 1;
 				goto retry;
 			}
-			die_errno("cannot chdir to %s", argv[0]);
+			die_errno(_("cannot chdir to %s"), argv[0]);
 		}
 	} else if (0 < argc) {
 		usage(init_db_usage[0]);
@@ -476,8 +476,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	git_dir = getenv(GIT_DIR_ENVIRONMENT);
 	if ((!git_dir || is_bare_repository_cfg == 1)
 	    && getenv(GIT_WORK_TREE_ENVIRONMENT))
-		die("%s (or --work-tree=<directory>) not allowed without "
-		    "specifying %s (or --git-dir=<directory>)",
+		die(_("%s (or --work-tree=<directory>) not allowed without "
+			  "specifying %s (or --git-dir=<directory>)"),
 		    GIT_WORK_TREE_ENVIRONMENT,
 		    GIT_DIR_ENVIRONMENT);
 
@@ -502,10 +502,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 		if (!git_work_tree_cfg) {
 			git_work_tree_cfg = xcalloc(PATH_MAX, 1);
 			if (!getcwd(git_work_tree_cfg, PATH_MAX))
-				die_errno ("Cannot access current working directory");
+				die_errno (_("Cannot access current working directory"));
 		}
 		if (access(get_git_work_tree(), X_OK))
-			die_errno ("Cannot access work tree '%s'",
+			die_errno (_("Cannot access work tree '%s'"),
 				   get_git_work_tree());
 	}
 
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 06/17] gettext: localize the main git-init message
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (4 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:10   ` Jonathan Nieder
  2010-08-30 21:28 ` [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "") Ævar Arnfjörð Bjarmason
                   ` (13 subsequent siblings)
  19 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change the git-init "Initialized empty Git repository" message and its
variants to use gettext.

This is one of the messages that could do with splitting up, I had a
WIP patch to do that that began like this:

    const char *reinit_shared   = _("Reinitialized existing shared Git repository in %s\n");
    const char *init_shared	    = _("Initialized empty shared Git repository in %s\n");
    const char *reinit_noshared = _("Reinitialized existing Git repository in %s\n");
    const char *init_noshared   = _("Initialized empty Git repository in %s\n");

But in the first round of gettextization I'm aiming to keep code
changes to a minimum for ease of review.

We can solicit input from translators about which messages that use
too much sprintf-ing are troublesome, and change those later.

Note that the TRANSLATORS comment doesn't use the usual Git
style. This is because everything from "/* TRANSLATORS: " to "*/" will
extracted as-is xgettext(1) and presented to translators, including
newlines and leading "*"'s. There seems to be no way to change that,
short of patching xgettext itself.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/init-db.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 9c08985..0224dee 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -348,9 +348,13 @@ int init_db(const char *template_dir, unsigned int flags)
 	if (!(flags & INIT_DB_QUIET)) {
 		const char *git_dir = get_git_dir();
 		int len = strlen(git_dir);
-		printf("%s%s Git repository in %s%s\n",
-		       reinit ? "Reinitialized existing" : "Initialized empty",
-		       shared_repository ? " shared" : "",
+
+		/* TRANSLATORS: The first '%s' is either "Reinitialized
+		   existing" or "Initialized empty", the second " shared" or
+		   "", and the last '%s%s' is the verbatim directory name. */
+		printf(_("%s%s Git repository in %s%s\n"),
+		       reinit ? _("Reinitialized existing") : _("Initialized empty"),
+		       shared_repository ? _(" shared") : "",
 		       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
 	}
 
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (5 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 06/17] gettext: localize the main git-init message Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:18   ` Jonathan Nieder
  2010-08-30 21:28 ` [PATCH/RFC 08/17] gettext tests: test if $VERSION exists before using it Ævar Arnfjörð Bjarmason
                   ` (12 subsequent siblings)
  19 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change the gettext setup code to arrange for messages to be emitted in
the user's requested encoding, but avoid setting LC_CTYPE from the
environment for the whole program.

In 107880a I removed our use of setlocale(LC_CTYPE, "") because of a
bug in the GNU C Library [1]. Even if it wasn't for that bug we
wouldn't want to use LC_CTYPE at this point, because it'd require
auditing all the code that uses C functions whose semantics are
modified by LC_CTYPE.

But only setting LC_MESSAGES as we do creates a problem, since we
declare the encoding of our PO files[2] the gettext implementation
will try to recode it to the user's locale, but without LC_CTYPE it'll
emit something like this on 'git init'

    Bj? til t?ma Git lind ? /hl/agh/.git/

Gettext knows about the encoding of our PO file, but we haven't told
it about the user's encoding, so all the non-US-ASCII characters get
encoded to question marks.

But we're in luck! We can set LC_CTYPE from the environment only while
we call nl_langinfo and bind_textdomain_codeset. That suffices to tell
gettext what encoding it should emit in, so it'll now say:

    Bjó til tóma Git lind í /hl/agh/.git/

And the equivalent ISO-8859-1 string will be emitted under a
ISO-8859-1 locale.

With this change way we get the advantages of setting LC_CTYPE (talk
to the user in his language/encoding), without the drawbacks (changed
semantics for C functions we rely on).

In the long term we should probably see about getting that bug in
glibc fixed, and audit our code so it won't fall apart under a non-C
locale.

1. http://sourceware.org/bugzilla/show_bug.cgi?id=6530
2. E.g. "Content-Type: text/plain; charset=UTF-8\n" in po/is.po

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 gettext.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gettext.c b/gettext.c
index db99742..8644098 100644
--- a/gettext.c
+++ b/gettext.c
@@ -1,11 +1,13 @@
 #include "exec_cmd.h"
 #include <locale.h>
 #include <libintl.h>
+#include <langinfo.h>
 #include <stdlib.h>
 
 extern void git_setup_gettext(void) {
 	char *podir;
 	char *envdir = getenv("GIT_TEXTDOMAINDIR");
+	char *charset;
 
 	if (envdir) {
 		(void)bindtextdomain("git", envdir);
@@ -17,5 +19,9 @@ extern void git_setup_gettext(void) {
 	}
 
 	(void)setlocale(LC_MESSAGES, "");
+	(void)setlocale(LC_CTYPE, "");
+	charset = nl_langinfo(CODESET);
+	(void)bind_textdomain_codeset("git", charset);
+	(void)setlocale(LC_CTYPE, "C");
 	(void)textdomain("git");
 }
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 08/17] gettext tests: test if $VERSION exists before using it
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (6 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "") Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 09/17] gettext tests: update test/is.po to match t/t0200/test.c Ævar Arnfjörð Bjarmason
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Versions of Locale::Messages before 1.17 didn't have a $VERSION
variable. This caused test failures on boxes that had this old version
installed, since the warnings pragma emits warnings on STDERR, which
fails the test.

Change the test to work around this by first checking if the $VERSION
variable is defined before using it.

Reported-by: Jens Lehmann <Jens.Lehmann@web.de>
Tested-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0202/test.pl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/t/t0202/test.pl b/t/t0202/test.pl
index c2055fa..6b00603 100644
--- a/t/t0202/test.pl
+++ b/t/t0202/test.pl
@@ -11,7 +11,9 @@ my $has_gettext_library = $Git::I18N::__HAS_LIBRARY;
 
 ok(1, "Testing Git::I18N version $Git::I18N::VERSION with " .
 	 ($has_gettext_library
-	  ? "Locale::Messages version $Locale::Messages::VERSION"
+	  ? (defined $Locale::Messages::VERSION
+		 ? "Locale::Messages version $Locale::Messages::VERSION"
+		 : "Locale::Messages version <1.17")
 	  : "NO Perl gettext library"));
 ok(1, "Git::I18N is located at $INC{'Git/I18N.pm'}");
 
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 09/17] gettext tests: update test/is.po to match t/t0200/test.c
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (7 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 08/17] gettext tests: test if $VERSION exists before using it Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 10/17] gettext tests: add detection for is_IS.ISO-8859-1 locale Ævar Arnfjörð Bjarmason
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change test.c to use '' quotes around "git help COMMAND" as git.c
does. An earlier version of the gettext series didn't use '' quotes,
but I hadn't run msgmerge since then so I didn't spot it.

For reference, the msgmerge command:

    msgmerge --backup=off -U is.po git.pot

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 po/is.po                 |    4 ++--
 t/t0200-gettext-basic.sh |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/po/is.po b/po/is.po
index 95739f1..2f3a220 100644
--- a/po/is.po
+++ b/po/is.po
@@ -10,8 +10,8 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 
 #: t/t0200/test.c:4
-msgid "See git help COMMAND for more information on a specific command."
-msgstr "Sjá git help SKIPUN til að sjá hjálp fyrir tiltekna skipun."
+msgid "See 'git help COMMAND' for more information on a specific command."
+msgstr "Sjá 'git help SKIPUN' til að sjá hjálp fyrir tiltekna skipun."
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
 #: t/t0200/test.c:9
diff --git a/t/t0200-gettext-basic.sh b/t/t0200-gettext-basic.sh
index 522338d..3846ea8 100755
--- a/t/t0200-gettext-basic.sh
+++ b/t/t0200-gettext-basic.sh
@@ -66,10 +66,10 @@ test_expect_success GETTEXT_LOCALE 'sanity: gettext(unknown) is passed through'
 test_expect_success GETTEXT_LOCALE 'xgettext: C extraction of _() and N_() strings' '
     printf "TILRAUN: C tilraunastrengur" >expect &&
     printf "\n" >>expect &&
-    printf "Sjá git help SKIPUN til að sjá hjálp fyrir tiltekna skipun." >>expect &&
+    printf "Sjá '\''git help SKIPUN'\'' til að sjá hjálp fyrir tiltekna skipun." >>expect &&
     LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: A C test string" >actual &&
     printf "\n" >>actual &&
-    LANGUAGE=is LC_ALL="$is_IS_locale" gettext "See git help COMMAND for more information on a specific command." >>actual &&
+    LANGUAGE=is LC_ALL="$is_IS_locale" gettext "See '\''git help COMMAND'\'' for more information on a specific command." >>actual &&
     test_cmp expect actual
 '
 
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 10/17] gettext tests: add detection for is_IS.ISO-8859-1 locale
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (8 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 09/17] gettext tests: update test/is.po to match t/t0200/test.c Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 11/17] gettext tests: test message re-encoding under Shell Ævar Arnfjörð Bjarmason
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Add a GETTEXT_ISO_LOCALE prerequisite to lib-gettext.sh, it'll be set
if we have an is_IS.ISO-8859-1 locale.

This is needed for an upcoming test that checks if our gettext library
can recode our UTF-8 po/is.po to is_IS.ISO-8859-1 on request.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/lib-gettext.sh |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index f0cdd3d..4570ead 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -18,9 +18,15 @@ then
 		p
 		q
 	}')
-	# Export it as an environmental variable so the t0202/test.pl Perl
-	# test can use it too
-	export is_IS_locale
+	# is_IS.ISO8859-1 on Solaris and FreeBSD, is_IS.iso88591 on Debian
+	is_IS_iso_locale=$(locale -a | sed -n '/^is_IS\.[iI][sS][oO]8859-*1$/{
+		p
+		q
+	}')
+
+	# Export them as an environmental variable so the t0202/test.pl
+	# Perl test can use it too
+	export is_IS_locale is_IS_iso_locale
 
 	if test -n "$is_IS_locale" &&
 		test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
@@ -35,6 +41,20 @@ then
 	else
 		say "# lib-gettext: No is_IS UTF-8 locale available"
 	fi
+
+	if test -n "$is_IS_iso_locale" &&
+		test $GIT_INTERNAL_GETTEXT_SH_SCHEME != "fallthrough"
+	then
+		# Some of the tests need the reference Icelandic locale
+		test_set_prereq GETTEXT_ISO_LOCALE
+
+		# Exporting for t0202/test.pl
+		GETTEXT_ISO_LOCALE=1
+		export GETTEXT_ISO_LOCALE
+		say "# lib-gettext: Found '$is_IS_iso_locale' as a is_IS ISO-8859-1 locale"
+	else
+		say "# lib-gettext: No is_IS ISO-8859-1 locale available"
+	fi
 else
 	# Only run some tests when we don't have gettext support
 	test_set_prereq NO_GETTEXT
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 11/17] gettext tests: test message re-encoding under Shell
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (9 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 10/17] gettext tests: add detection for is_IS.ISO-8859-1 locale Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 12/17] gettext tests: test re-encoding with a UTF-8 msgid " Ævar Arnfjörð Bjarmason
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Our PO files are written in UTF-8, but We're not using
setlocale(LC_CTYPE, "") so it's not a given that someone with e.g. a
ISO-8859-1 locale will get messages in ISO-8859-1, and not UTF-8.

Introduce a new test to test for this, it uses the recently added
GETTEXT_ISO_LOCALE prerequisite.

This patch only tests the shellscript portion of our gettext
interface. I can't get any of these tests to fail on any of the
gettext implementations I have around, even without the previous patch
to gettext.c. But having exhaustive tests in this area is good
regardless.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 po/is.po                           |   12 ++++++++++
 t/t0200/test.c                     |    6 +++++
 t/t0204-gettext-reencode-sanity.sh |   43 ++++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100755 t/t0204-gettext-reencode-sanity.sh

diff --git a/po/is.po b/po/is.po
index 2f3a220..39b63b9 100644
--- a/po/is.po
+++ b/po/is.po
@@ -25,6 +25,18 @@ msgid "TEST: A C test string %s"
 msgstr "TILRAUN: C tilraunastrengur %s"
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:15
+#, c-format
+msgid "TEST: Hello World!"
+msgstr "TILRAUN: Halló Heimur!"
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:18
+#, c-format
+msgid "TEST: Old English Runes"
+msgstr "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
 #: t/t0200/test.sh:8
 msgid "TEST: A Shell test string"
 msgstr "TILRAUN: Skeljartilraunastrengur"
diff --git a/t/t0200/test.c b/t/t0200/test.c
index 93373b3..82682dc 100644
--- a/t/t0200/test.c
+++ b/t/t0200/test.c
@@ -10,4 +10,10 @@ int main(void)
 
 	/* TRANSLATORS: This is a test. You don't need to translate it. */
 	printf(_("TEST: A C test string %s"), "variable");
+
+	/* TRANSLATORS: This is a test. You don't need to translate it. */
+	printf(_("TEST: Hello World!"));
+
+	/* TRANSLATORS: This is a test. You don't need to translate it. */
+	printf(_("TEST: Old English Runes"));
 }
diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
new file mode 100755
index 0000000..3222e37
--- /dev/null
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Copyright (c) 2010 Ævar Arnfjörð Bjarmason
+#
+
+test_description="Gettext reencoding of our *.po/*.mo files works"
+
+. ./lib-gettext.sh
+
+
+test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Icelandic' '
+    printf "TILRAUN: Halló Heimur!" >expect &&
+    LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Hello World!" >actual &&
+    test_cmp expect actual
+'
+
+test_expect_success GETTEXT_LOCALE 'gettext: Emitting UTF-8 from our UTF-8 *.mo files / Runes' '
+    printf "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ" >expect &&
+    LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: Old English Runes" >actual &&
+    test_cmp expect actual
+'
+
+test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Icelandic' '
+    printf "TILRAUN: Halló Heimur!" | iconv -f UTF-8 -t ISO8859-1 >expect &&
+    LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Hello World!" >actual &&
+    test_cmp expect actual
+'
+
+test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UTF-8 *.mo files / Runes' '
+    LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: Old English Runes" >runes &&
+
+	if grep "^TEST: Old English Runes$" runes
+	then
+		say "Your system can not handle this complexity and returns the string as-is"
+	else
+		# Both Solaris and GNU libintl will return this stream of
+		# question marks, so it is s probably portable enough
+		printf "TILRAUN: ?? ???? ??? ?? ???? ?? ??? ????? ??????????? ??? ?? ????" >runes-expect &&
+		test_cmp runes-expect runes
+	fi
+'
+
+test_done
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 12/17] gettext tests: test re-encoding with a UTF-8 msgid under Shell
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (10 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 11/17] gettext tests: test message re-encoding under Shell Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 13/17] gettext tests: mark a test message as not needing translation Ævar Arnfjörð Bjarmason
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

A test that tests that calling gettext on a UTF-8 msgid works, and
that recoding the resulting string works too.

This test uses the --from-code=UTF-8 xgettext(1) argument introduced
in an earlier patch.

This patch only tests the shellscript portion of our gettext
interface. I can't get any of these tests to fail on any of the
gettext implementations I have around, even without the previous patch
to gettext.c. But having exhaustive tests in this area is good
regardless.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 po/is.po                           |    6 ++++++
 t/t0200/test.c                     |    3 +++
 t/t0204-gettext-reencode-sanity.sh |   21 +++++++++++++++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/po/is.po b/po/is.po
index 39b63b9..dfa3804 100644
--- a/po/is.po
+++ b/po/is.po
@@ -37,6 +37,12 @@ msgid "TEST: Old English Runes"
 msgstr "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:21
+#, c-format
+msgid "TEST: ‘single’ and “double” quotes"
+msgstr "TILRAUN: ‚einfaldar‘ og „tvöfaldar“ gæsalappir"
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
 #: t/t0200/test.sh:8
 msgid "TEST: A Shell test string"
 msgstr "TILRAUN: Skeljartilraunastrengur"
diff --git a/t/t0200/test.c b/t/t0200/test.c
index 82682dc..ff15c2f 100644
--- a/t/t0200/test.c
+++ b/t/t0200/test.c
@@ -16,4 +16,7 @@ int main(void)
 
 	/* TRANSLATORS: This is a test. You don't need to translate it. */
 	printf(_("TEST: Old English Runes"));
+
+	/* TRANSLATORS: This is a test. You don't need to translate it. */
+	printf(_("TEST: ‘single’ and “double” quotes"));
 }
diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 3222e37..1a7ea37 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -40,4 +40,25 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Emitting ISO-8859-1 from our UT
 	fi
 '
 
+test_expect_success GETTEXT_LOCALE 'gettext: Fetching a UTF-8 msgid -> UTF-8' '
+    printf "TILRAUN: ‚einfaldar‘ og „tvöfaldar“ gæsalappir" >expect &&
+    LANGUAGE=is LC_ALL="$is_IS_locale" gettext "TEST: ‘single’ and “double” quotes" >actual &&
+    test_cmp expect actual
+'
+
+# How these quotes get transliterated depends on the gettext implementation:
+#
+#   Debian:  ,einfaldar' og ,,tvöfaldar" [GNU libintl]
+#   FreeBSD: `einfaldar` og "tvöfaldar"  [GNU libintl]
+#   Solaris: ?einfaldar? og ?tvöfaldar?  [Solaris libintl]
+#
+# Just make sure the contents are transliterated, and don't use grep -q
+# so that these differences are emitted under --verbose for curious
+# eyes.
+test_expect_success GETTEXT_ISO_LOCALE 'gettext: Fetching a UTF-8 msgid -> ISO-8859-1' '
+    LANGUAGE=is LC_ALL="$is_IS_iso_locale" gettext "TEST: ‘single’ and “double” quotes" >actual &&
+    grep "einfaldar" actual &&
+    grep "$(echo tvöfaldar | iconv -f UTF-8 -t ISO8859-1)" actual
+'
+
 test_done
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 13/17] gettext tests: mark a test message as not needing translation
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (11 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 12/17] gettext tests: test re-encoding with a UTF-8 msgid " Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 14/17] po/is.po: msgmerge and add Language: header Ævar Arnfjörð Bjarmason
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

This was the only message in t/t0200/* that didn't have a TRANSLATORS
comment, without it translators will waste time translating this
needlessly.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0200/test.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/t0200/test.c b/t/t0200/test.c
index ff15c2f..584d45c 100644
--- a/t/t0200/test.c
+++ b/t/t0200/test.c
@@ -1,6 +1,7 @@
 /* This is a phony C program that's only here to test xgettext message extraction */
 
 const char help[] =
+	/* TRANSLATORS: This is a test. You don't need to translate it. */
 	N_("See 'git help COMMAND' for more information on a specific command.");
 
 int main(void)
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 14/17] po/is.po: msgmerge and add Language: header
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (12 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 13/17] gettext tests: mark a test message as not needing translation Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 15/17] po/is.po: add Icelandic translation Ævar Arnfjörð Bjarmason
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change is.po to use the header order added by msgmerge(1), this'll
make subsequent diffs to it smaller and easier to manage. While I'm at
it add a Language header indicating that the file is in
Icelandic.

When we add more *.po files later we should add a Language header to
those as well.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 po/is.po |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/po/is.po b/po/is.po
index dfa3804..3bbfb97 100644
--- a/po/is.po
+++ b/po/is.po
@@ -1,10 +1,12 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
-"PO-Revision-Date: 2010-06-05 19:06 +0000\n"
-"Language-Team: Git Mailing List <git@vger.kernel.org>\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
+"POT-Creation-Date: 2010-08-28 17:38+0000\n"
+"PO-Revision-Date: 2010-08-28 17:27+0000\n"
 "Last-Translator: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"
+"Language-Team: Git Mailing List <git@vger.kernel.org>\n"
+"Language: is\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 15/17] po/is.po: add Icelandic translation
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (13 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 14/17] po/is.po: msgmerge and add Language: header Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:29   ` Jonathan Nieder
  2010-08-30 21:28 ` [PATCH/RFC 16/17] po/pl.po: add Polish translation Ævar Arnfjörð Bjarmason
                   ` (4 subsequent siblings)
  19 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Translate the non-TEST messages added in recent patches against
init-db.c. This brings Icelandic translation coverage up to 100%.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 po/is.po |  135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 127 insertions(+), 8 deletions(-)

diff --git a/po/is.po b/po/is.po
index 3bbfb97..5a35f0a 100644
--- a/po/is.po
+++ b/po/is.po
@@ -2,8 +2,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Git\n"
 "Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
-"POT-Creation-Date: 2010-08-28 17:38+0000\n"
-"PO-Revision-Date: 2010-08-28 17:27+0000\n"
+"POT-Creation-Date: 2010-08-30 18:16+0000\n"
+"PO-Revision-Date: 2010-08-28 19:25+0000\n"
 "Last-Translator: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"
 "Language-Team: Git Mailing List <git@vger.kernel.org>\n"
 "Language: is\n"
@@ -11,35 +11,154 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: t/t0200/test.c:4
+#: builtin/init-db.c:34
+#, c-format
+msgid "Could not make %s writable by group"
+msgstr "Gat ekki gert %s skrifanlega af hóp"
+
+#: builtin/init-db.c:61
+#, c-format
+msgid "insanely long template name %s"
+msgstr "brjálæðislega langt sniðsnafn %s"
+
+#: builtin/init-db.c:66
+#, c-format
+msgid "cannot stat '%s'"
+msgstr "gat ekki stat-að '%s'"
+
+#: builtin/init-db.c:72
+#, c-format
+msgid "cannot stat template '%s'"
+msgstr "gat ekki stat-að sniðið '%s'"
+
+#: builtin/init-db.c:79
+#, c-format
+msgid "cannot opendir '%s'"
+msgstr "gat ekki opnað móppuna '%s'"
+
+#: builtin/init-db.c:96
+#, c-format
+msgid "cannot readlink '%s'"
+msgstr "gat ekki lesið tengilinn '%s'"
+
+#: builtin/init-db.c:98
+#, c-format
+msgid "insanely long symlink %s"
+msgstr "brjálæðislega langur tengill %s"
+
+#: builtin/init-db.c:101
+#, c-format
+msgid "cannot symlink '%s' '%s'"
+msgstr "gat ekki búið til tengilinn '%s' '%s'"
+
+#: builtin/init-db.c:105
+#, c-format
+msgid "cannot copy '%s' to '%s'"
+msgstr "gat ekki afritað '%s' til '%s'"
+
+#: builtin/init-db.c:109
+#, c-format
+msgid "ignoring template %s"
+msgstr "hunsa sniðið %s"
+
+#: builtin/init-db.c:132
+#, c-format
+msgid "insanely long template path %s"
+msgstr "brjálæðislega löng slóð á snið %s"
+
+#: builtin/init-db.c:140
+#, c-format
+msgid "templates not found %s"
+msgstr "sniðið fannst ekki %s"
+
+#: builtin/init-db.c:153
+#, c-format
+msgid "not copying templates of a wrong format version %d from '%s'"
+msgstr "aftira ekki sniðin vegna rangar útgáfu %d frá '%s'"
+
+#: builtin/init-db.c:191
+#, c-format
+msgid "insane git directory %s"
+msgstr "brjálúð git mappa %s"
+
+#. TRANSLATORS: The first '%s' is either "Reinitialized
+#. existing" or "Initialized empty", the second " shared" or
+#. "", and the last '%s%s' is the verbatim directory name.
+#: builtin/init-db.c:355
+#, c-format
+msgid "%s%s Git repository in %s%s\n"
+msgstr "%s%s Git lind í %s%s\n"
+
+#: builtin/init-db.c:356
+msgid "Reinitialized existing"
+msgstr "Endurgerði"
+
+#: builtin/init-db.c:356
+msgid "Initialized empty"
+msgstr "Bjó til tóma"
+
+#: builtin/init-db.c:357
+msgid " shared"
+msgstr " sameiginlega"
+
+#: builtin/init-db.c:376
+msgid "cannot tell cwd"
+msgstr "finn ekki núverandi möppu"
+
+#: builtin/init-db.c:450 builtin/init-db.c:457
+#, c-format
+msgid "cannot mkdir %s"
+msgstr "gat ekki búið til möppuna %s"
+
+#: builtin/init-db.c:461
+#, c-format
+msgid "cannot chdir to %s"
+msgstr "get ekki farið inn í möppuna %s"
+
+#: builtin/init-db.c:483
+#, c-format
+msgid "%s (or --work-tree=<directory>) not allowed without specifying %s (or --git-dir=<directory>)"
+msgstr "%s (eða --work-tree=<mappa>) ekki leyfilegt ásamt %s (eða --git-dir=<mappa>)"
+
+#: builtin/init-db.c:509
+msgid "Cannot access current working directory"
+msgstr "Get ekki opnað núverandi vinnumöppu"
+
+#: builtin/init-db.c:512
+#, c-format
+msgid "Cannot access work tree '%s'"
+msgstr "Get ekki opnað vinnutré '%s'"
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:5
 msgid "See 'git help COMMAND' for more information on a specific command."
 msgstr "Sjá 'git help SKIPUN' til að sjá hjálp fyrir tiltekna skipun."
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
-#: t/t0200/test.c:9
+#: t/t0200/test.c:10
 msgid "TEST: A C test string"
 msgstr "TILRAUN: C tilraunastrengur"
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
-#: t/t0200/test.c:12
+#: t/t0200/test.c:13
 #, c-format
 msgid "TEST: A C test string %s"
 msgstr "TILRAUN: C tilraunastrengur %s"
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
-#: t/t0200/test.c:15
+#: t/t0200/test.c:16
 #, c-format
 msgid "TEST: Hello World!"
 msgstr "TILRAUN: Halló Heimur!"
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
-#: t/t0200/test.c:18
+#: t/t0200/test.c:19
 #, c-format
 msgid "TEST: Old English Runes"
 msgstr "TILRAUN: ᚻᛖ ᚳᚹᚫᚦ ᚦᚫᛏ ᚻᛖ ᛒᚢᛞᛖ ᚩᚾ ᚦᚫᛗ ᛚᚪᚾᛞᛖ ᚾᚩᚱᚦᚹᛖᚪᚱᛞᚢᛗ ᚹᛁᚦ ᚦᚪ ᚹᛖᛥᚫ"
 
 #. TRANSLATORS: This is a test. You don't need to translate it.
-#: t/t0200/test.c:21
+#: t/t0200/test.c:22
 #, c-format
 msgid "TEST: ‘single’ and “double” quotes"
 msgstr "TILRAUN: ‚einfaldar‘ og „tvöfaldar“ gæsalappir"
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 16/17] po/pl.po: add Polish translation
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (14 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 15/17] po/is.po: add Icelandic translation Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:28 ` [PATCH/RFC 17/17] gettext tests: test message re-encoding under C Ævar Arnfjörð Bjarmason
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

From: Marcin Cieślak <saper@saper.info>

Translate all the translatable messages currently in Git, except for
the 10 TEST messages that shouldn't be translated.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Marcin Cieślak <saper@saper.info>
---
 po/pl.po |  187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 187 insertions(+), 0 deletions(-)
 create mode 100644 po/pl.po

diff --git a/po/pl.po b/po/pl.po
new file mode 100644
index 0000000..dfdd416
--- /dev/null
+++ b/po/pl.po
@@ -0,0 +1,187 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Git\n"
+"Report-Msgid-Bugs-To: Git Mailing List <git@vger.kernel.org>\n"
+"POT-Creation-Date: 2010-08-30 18:16+0000\n"
+"PO-Revision-Date: 2010-08-30 17:02+0200\n"
+"Last-Translator: Marcin Cieślak <saper@saper.info>\n"
+"Language-Team: Git Mailing List <git@vger.kernel.org>\n"
+"Language: pl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+
+#: builtin/init-db.c:34
+#, c-format
+msgid "Could not make %s writable by group"
+msgstr "Nie mogę dać prawa zapisu grupie w %s"
+
+#: builtin/init-db.c:61
+#, c-format
+msgid "insanely long template name %s"
+msgstr "beznadziejnie długa nazwa szablonu %s"
+
+#: builtin/init-db.c:66
+#, c-format
+msgid "cannot stat '%s'"
+msgstr "nie mogę tknąć '%s'"
+
+#: builtin/init-db.c:72
+#, c-format
+msgid "cannot stat template '%s'"
+msgstr "nie mogę tknąć szablonu '%s'"
+
+#: builtin/init-db.c:79
+#, c-format
+msgid "cannot opendir '%s'"
+msgstr "nie mogę otworzyć katalogu '%s'"
+
+#: builtin/init-db.c:96
+#, c-format
+msgid "cannot readlink '%s'"
+msgstr "readlink nie zadziałało dla '%s'"
+
+#: builtin/init-db.c:98
+#, c-format
+msgid "insanely long symlink %s"
+msgstr "beznadziejnie długi link symboliczny %s"
+
+#: builtin/init-db.c:101
+#, c-format
+msgid "cannot symlink '%s' '%s'"
+msgstr "nie mogę założyć symbolicznego link z '%s' do '%s'"
+
+#: builtin/init-db.c:105
+#, c-format
+msgid "cannot copy '%s' to '%s'"
+msgstr "nie mogę skopiować '%s' to '%s'"
+
+#: builtin/init-db.c:109
+#, c-format
+msgid "ignoring template %s"
+msgstr "pomijam szablon %s"
+
+#: builtin/init-db.c:132
+#, c-format
+msgid "insanely long template path %s"
+msgstr "beznadziejnie długa śieżka do wzorca %s"
+
+#: builtin/init-db.c:140
+#, c-format
+msgid "templates not found %s"
+msgstr "nie znaleziono szablonów %s"
+
+#: builtin/init-db.c:153
+#, c-format
+msgid "not copying templates of a wrong format version %d from '%s'"
+msgstr "nie będę kopiować szablonów oznaczonych niewłaściwym numerem wersji %d z '%s'"
+
+#: builtin/init-db.c:191
+#, c-format
+msgid "insane git directory %s"
+msgstr "beznadziejny katalog gita %s"
+
+#. TRANSLATORS: The first '%s' is either "Reinitialized
+#. existing" or "Initialized empty", the second " shared" or
+#. "", and the last '%s%s' is the verbatim directory name.
+#: builtin/init-db.c:355
+#, c-format
+msgid "%s%s Git repository in %s%s\n"
+msgstr "%s%s repozytorium Gita w %s%s\n"
+
+#: builtin/init-db.c:356
+msgid "Reinitialized existing"
+msgstr "Ponownie zainicjowałem istniejące"
+
+#: builtin/init-db.c:356
+msgid "Initialized empty"
+msgstr "Utworzyłem puste"
+
+#: builtin/init-db.c:357
+msgid " shared"
+msgstr " współdzielone"
+
+#: builtin/init-db.c:376
+msgid "cannot tell cwd"
+msgstr "nie wiem w którym katalogu jestem"
+
+#: builtin/init-db.c:450 builtin/init-db.c:457
+#, c-format
+msgid "cannot mkdir %s"
+msgstr "nie mogę utworzyć katalogu %s"
+
+#: builtin/init-db.c:461
+#, c-format
+msgid "cannot chdir to %s"
+msgstr "nie mogę wejść do katalogu %s"
+
+#: builtin/init-db.c:483
+#, c-format
+msgid "%s (or --work-tree=<directory>) not allowed without specifying %s (or --git-dir=<directory>)"
+msgstr "nie można użyć %s (or --work-tree=<katalog>) bez podania %s (or --git-dir=<katalog>)"
+
+#: builtin/init-db.c:509
+msgid "Cannot access current working directory"
+msgstr "Nie mogę dobrać się do bieżącego katalogu"
+
+#: builtin/init-db.c:512
+#, c-format
+msgid "Cannot access work tree '%s'"
+msgstr "Nie mogę dostać się do drzewa roboczego '%s'"
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:5
+msgid "See 'git help COMMAND' for more information on a specific command."
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:10
+msgid "TEST: A C test string"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:13
+#, c-format
+msgid "TEST: A C test string %s"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:16
+#, c-format
+msgid "TEST: Hello World!"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:19
+#, c-format
+msgid "TEST: Old English Runes"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.c:22
+#, c-format
+msgid "TEST: ‘single’ and “double” quotes"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.sh:8
+msgid "TEST: A Shell test string"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.sh:11
+#, sh-format
+msgid "TEST: A Shell test $variable"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.perl:8
+msgid "TEST: A Perl test string"
+msgstr ""
+
+#. TRANSLATORS: This is a test. You don't need to translate it.
+#: t/t0200/test.perl:11
+#, perl-format
+msgid "TEST: A Perl test variable %s"
+msgstr ""
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [PATCH/RFC 17/17] gettext tests: test message re-encoding under C
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (15 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 16/17] po/pl.po: add Polish translation Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason
  2010-08-30 21:42 ` [PATCH/RFC 00/17] Begin gettextizing Git Junio C Hamano
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-30 21:28 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Add tests for message re-encoding under C. Unlike the Shell tests
these tests will break under GNU libintl if the recent patch to
gettext.c is reverted. So this serves as a regression test for that
issue.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t0204-gettext-reencode-sanity.sh |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/t/t0204-gettext-reencode-sanity.sh b/t/t0204-gettext-reencode-sanity.sh
index 1a7ea37..189af90 100755
--- a/t/t0204-gettext-reencode-sanity.sh
+++ b/t/t0204-gettext-reencode-sanity.sh
@@ -61,4 +61,18 @@ test_expect_success GETTEXT_ISO_LOCALE 'gettext: Fetching a UTF-8 msgid -> ISO-8
     grep "$(echo tvöfaldar | iconv -f UTF-8 -t ISO8859-1)" actual
 '
 
+test_expect_success GETTEXT_LOCALE 'gettext.c: git init UTF-8 -> UTF-8' '
+    printf "Bjó til tóma Git lind" >expect &&
+    LANGUAGE=is LC_ALL="$is_IS_locale" git init repo >actual &&
+    test_when_finished "rm -rf repo" &&
+    grep "^$(cat expect) " actual
+'
+
+test_expect_success GETTEXT_ISO_LOCALE 'gettext.c: git init UTF-8 -> ISO-8859-1' '
+    printf "Bjó til tóma Git lind" >expect &&
+    LANGUAGE=is LC_ALL="$is_IS_iso_locale" git init repo >actual &&
+    test_when_finished "rm -rf repo" &&
+    grep "^$(cat expect | iconv -f UTF-8 -t ISO8859-1) " actual
+'
+
 test_done
-- 
1.7.2.2.536.g3f548

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (16 preceding siblings ...)
  2010-08-30 21:28 ` [PATCH/RFC 17/17] gettext tests: test message re-encoding under C Ævar Arnfjörð Bjarmason
@ 2010-08-30 21:42 ` Junio C Hamano
  2010-08-31  9:02   ` [PATCH] gettext: Make NO_GETTEXT=YesPlease the default in releases Ævar Arnfjörð Bjarmason
  2010-08-31 17:18   ` [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
  2010-08-31 11:08 ` Peter Krefting
  2010-08-31 15:32 ` Jonathan Nieder
  19 siblings, 2 replies; 55+ messages in thread
From: Junio C Hamano @ 2010-08-30 21:42 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Jonathan Nieder, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:

> Now that Git has the infrastructure for translation in next I'm going
> to start submitting patches to make the main porcelain translatable.
>
> This series starts that work, and fixes and also fixes up some of the
> infrastructure (like the bug discussed in "Odd encoding issue with
> UTF-8 + gettext yields ? on non-ASCII"), and adds tests to make sure
> it's all working.
>
> With it applied git-init is the one and only utility of the porcelain
> that's translatable. The series includes a translation of it into
> Icelandic and Polish.
>
> I think it's ready to be applied. I tested it on Solaris, FreeBSD and
> Debian. But there's almost definitely something I'm missing in a
> series this big, so it's an RFC.

Thanks; will queue them.

I however strongly suspect that we would be better off first kicking the
earlier parts of i18n topic out of 'next' back to 'pu', as I am hoping
that we can declare feature freeze for 1.7.3 by the end of this week at
the latest, and you can never tell if we got the "infrastructure" right
without playing with a real "user of the infrastructure" like this 17
patch series, which means that the part of i18n topic that is already in
'next' cannot be part of 1.7.3 --- it is way premature.

It was somewhat unfortunate and sad that your "test" series depended on a
few patches from the i18n series, which means it is now taken hostage to
the latter.  I'd rather want to have the "test" series in the 1.7.3, and
we need to think about a way to untangle the two topics.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [PATCH] gettext: Make NO_GETTEXT=YesPlease the default in releases
  2010-08-30 21:42 ` [PATCH/RFC 00/17] Begin gettextizing Git Junio C Hamano
@ 2010-08-31  9:02   ` Ævar Arnfjörð Bjarmason
  2010-08-31 17:18   ` [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
  1 sibling, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31  9:02 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jonathan Nieder, Marcin Cieslak, Jens Lehmann,
	Ævar Arnfjörð Bjarmason

Change the Git build process so that gettext is no longer built by
default as part of Git releases, and include a loud warning to
downstream distributors in INSTALL saying that they shouldn't enable
it.

We're still working out the details of the gettext infrastructure and
currently only a small portion of Git can be translated, so it's
premature to enable it by default.

However it's painful for everyone if the source changes needed for
gettext can't be made in pu without conflicting with other series that
apply to maint/master/next.

When gettext is disabled the whole functionality basically boils down
to this macro definition (or Shell and Perl equivalents) and a few
skipping tests:

    #define _(s) (s)

So it's a lot less to get right than if we were enabling it by
default.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---

On Mon, Aug 30, 2010 at 21:42, Junio C Hamano <gitster@pobox.com> wrote:
> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>
>> Now that Git has the infrastructure for translation in next I'm going
>> to start submitting patches to make the main porcelain translatable.
>>
>> This series starts that work, and fixes and also fixes up some of the
>> infrastructure (like the bug discussed in "Odd encoding issue with
>> UTF-8 + gettext yields ? on non-ASCII"), and adds tests to make sure
>> it's all working.
>>
>> With it applied git-init is the one and only utility of the porcelain
>> that's translatable. The series includes a translation of it into
>> Icelandic and Polish.
>>
>> I think it's ready to be applied. I tested it on Solaris, FreeBSD and
>> Debian. But there's almost definitely something I'm missing in a
>> series this big, so it's an RFC.
>
> Thanks; will queue them.

Thanks!

> I however strongly suspect that we would be better off first kicking the
> earlier parts of i18n topic out of 'next' back to 'pu', as I am hoping
> that we can declare feature freeze for 1.7.3 by the end of this week at
> the latest, and you can never tell if we got the "infrastructure" right
> without playing with a real "user of the infrastructure" like this 17
> patch series, which means that the part of i18n topic that is already in
> 'next' cannot be part of 1.7.3 --- it is way premature.

I definitely agree that it's premature at this point, if for no other
reason than that I'll never be able to make most of the main-porcelain
translatable by the end of the week.

However, there's another way to do this. Simply disable it by default
in releases. Which this patch implements.

I considered the possibility that we might want to disable it in
select branches when I wrote it, so it's easy to do so. And IMO a
better option due to the reasons cited in the commit message attached
to the PATCH.

> It was somewhat unfortunate and sad that your "test" series depended on a
> few patches from the i18n series, which means it is now taken hostage to
> the latter.  I'd rather want to have the "test" series in the 1.7.3, and
> we need to think about a way to untangle the two topics.

Yeah I wasn't very careful about keeping the bits already in pu
separate. Untangling them shouldn't be that hard though, but hopefully
with this patch we won't have to go that route.

 INSTALL      |   17 +++++++++++++++--
 Makefile     |    4 ++++
 configure.ac |    2 +-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/INSTALL b/INSTALL
index e4e7506..aa477e2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -93,8 +93,21 @@ Issues of note:
 	  history graphically, and in git-gui.  If you don't want gitk or
 	  git-gui, you can use NO_TCLTK.
 
-	- A gettext library is used by default for localizing Git. The
-	  primary target is GNU libintl, but the Solaris gettext
+	- Git includes EXPERIMENTAL support for localization with gettext
+	  which is currently disabled by default in official Git
+	  releases.
+
+	  If you really want to build it you have to specify NO_GETTEXT=
+	  as a Makefile argument. If you're a downstream distributor
+	  please don't do so without consulting with the Git Mailing List
+	  first about the stability of this feature.
+
+	  It's only being included in releases so that source messages can
+	  be marked for translation without resulting in painful and
+	  inevitable merge conflicts between Git's pu branch and the
+	  rest. END WARNING.
+
+	  The primary target is GNU libintl, but the Solaris gettext
 	  implementation also works.
 
 	  We need a gettext.h on the system for C code, gettext.sh (or
diff --git a/Makefile b/Makefile
index 9818a59..bd61a5b 100644
--- a/Makefile
+++ b/Makefile
@@ -272,6 +272,10 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
 
+# Disable gettext by default in releases while the implementation is
+# settling
+NO_GETTEXT = YesPleaseForNow
+
 # Among the variables below, these:
 #   gitexecdir
 #   template_dir
diff --git a/configure.ac b/configure.ac
index 1821d89..c9b0265 100644
--- a/configure.ac
+++ b/configure.ac
@@ -806,7 +806,7 @@ AC_SUBST(HAVE_PATHS_H)
 #
 # Define NO_GETTEXT if you don't have libintl.h
 AC_CHECK_HEADER([libintl.h],
-[NO_GETTEXT=],
+[NO_GETTEXT=HaveItButYesPlease],
 [NO_GETTEXT=YesPlease])
 AC_SUBST(NO_GETTEXT)
 #
-- 
1.7.2.2.535.g1333f.dirty

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (17 preceding siblings ...)
  2010-08-30 21:42 ` [PATCH/RFC 00/17] Begin gettextizing Git Junio C Hamano
@ 2010-08-31 11:08 ` Peter Krefting
  2010-08-31 11:42   ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:32 ` Jonathan Nieder
  19 siblings, 1 reply; 55+ messages in thread
From: Peter Krefting @ 2010-08-31 11:08 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List

Ævar Arnfjörð Bjarmason:

> With it applied git-init is the one and only utility of the porcelain 
> that's translatable. The series includes a translation of it into 
> Icelandic and Polish.

Very interesting. I would like to contribute a Swedish translation as time 
permits.

Any chance the translations could be co-ordinated through Translation 
Project <URL:http://translationproject.org/>? I know I suggested this, and 
was turned down, for gitk and git-gui, but this translation is potentially 
larger and could benefit from the co-ordinated effort.

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 11:08 ` Peter Krefting
@ 2010-08-31 11:42   ` Ævar Arnfjörð Bjarmason
  2010-08-31 11:48     ` Peter Krefting
  2010-08-31 12:02     ` Matthieu Moy
  0 siblings, 2 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 11:42 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git Mailing List

On Tue, Aug 31, 2010 at 11:08, Peter Krefting <peter@softwolves.pp.se> wrote:
> Ævar Arnfjörð Bjarmason:
>
>> With it applied git-init is the one and only utility of the porcelain
>> that's translatable. The series includes a translation of it into Icelandic
>> and Polish.
>
> Very interesting. I would like to contribute a Swedish translation as time
> permits.

Great!

> Any chance the translations could be co-ordinated through Translation
> Project <URL:http://translationproject.org/>? I know I suggested this, and
> was turned down, for gitk and git-gui, but this translation is potentially
> larger and could benefit from the co-ordinated effort.

Something like that would be welcome. Personally I'm happy with
editing *.po files locally with Emacs's po-mode, but to get more
translators we probably want a friendly web interface like that at
some point. Preferably with an active translation community.

I meant to look at this myself at some point, but if you could help
that'd be great!

The only reference I could find to a previous git +
translationproject.org discussion was this:
http://kerneltrap.org/mailarchive/git/2008/3/14/1163164 Is that the
one you're talking about?

I've used Launchpad somewhat for translating and it's friendly to
contributors & has an active community, but it seems to require that
we BSD-license our translations[1], which would be a showstopper since
we'd have to contact everyone who's been submitting GPL-2-only strings
to Git for the last 5 years.

Translationproject seems to have a similar requirement[2], but they
seem require you to send a letter to the FSF through snail mail before
you can contribute (maybe not, I didn't read all their docs
carefully). That would be a major hurdle to casual contributors.

1. https://help.launchpad.net/Translations/LicensingFAQ
2. http://translationproject.org/disclaim.txt

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 11:42   ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 11:48     ` Peter Krefting
  2010-08-31 12:02     ` Matthieu Moy
  1 sibling, 0 replies; 55+ messages in thread
From: Peter Krefting @ 2010-08-31 11:48 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Git Mailing List

Ævar Arnfjörð Bjarmason:

> Something like that would be welcome. Personally I'm happy with editing 
> *.po files locally with Emacs's po-mode, but to get more translators we 
> probably want a friendly web interface like that at some point.

Well, it's not a web interface for translating, currently, just for keeping 
track on what needs to be translated by whom (and for language teams to find 
what to translate). You still edit the PO files in whatever you prefer.

> Preferably with an active translation community.

Translation Project is indeed very active.

> http://kerneltrap.org/mailarchive/git/2008/3/14/1163164 Is that the
> one you're talking about?

Yes.

> Translationproject seems to have a similar requirement[2], but they seem 
> require you to send a letter to the FSF through snail mail before you can 
> contribute (maybe not, I didn't read all their docs carefully).

Only when you translate FSF software for which you need to send one of the 
letters that claim that you are handing over copyright to the FSF. That is 
not needed in this case, and translators working on such projects do not 
need to send one.


For the project side, you bascially send a POT file every now and then, 
between string-freeze and release, and update the PO files that come back 
from the project every now and then. I've been using the system from both 
sides and it's lightweight enough to be workable.

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 11:42   ` Ævar Arnfjörð Bjarmason
  2010-08-31 11:48     ` Peter Krefting
@ 2010-08-31 12:02     ` Matthieu Moy
  2010-08-31 12:43       ` Ævar Arnfjörð Bjarmason
  1 sibling, 1 reply; 55+ messages in thread
From: Matthieu Moy @ 2010-08-31 12:02 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Peter Krefting, Git Mailing List

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> I've used Launchpad somewhat for translating and it's friendly to
> contributors & has an active community, but it seems to require that
> we BSD-license our translations[1], which would be a showstopper since
> we'd have to contact everyone who's been submitting GPL-2-only strings
> to Git for the last 5 years.

I don't think so:

,----[ https://help.launchpad.net/Translations/LicensingFAQ ]
| I have no problem with BSD myself, but I also uploaded translations
| from upstream. What do I do?
| 
| As long as the uploads were marked as translations that were published
| elsewhere, they fall under a separate copyright regime: those imports
| will retain their original copyright license. The BSD licence only
| applies to translations that are (as far as the system knows) original
| to Launchpad.
`----

So, my understanding is: Git's code, and strings, would remain what
they are, but things contributed _through launchpad_ would be BSD.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 12:02     ` Matthieu Moy
@ 2010-08-31 12:43       ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 12:43 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Peter Krefting, Git Mailing List

On Tue, Aug 31, 2010 at 12:02, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Ęvar Arnfjörš Bjarmason <avarab@gmail.com> writes:
>
>> I've used Launchpad somewhat for translating and it's friendly to
>> contributors & has an active community, but it seems to require that
>> we BSD-license our translations[1], which would be a showstopper since
>> we'd have to contact everyone who's been submitting GPL-2-only strings
>> to Git for the last 5 years.
>
> I don't think so:
>
> ,----[ https://help.launchpad.net/Translations/LicensingFAQ ]
> | I have no problem with BSD myself, but I also uploaded translations
> | from upstream. What do I do?
> |
> | As long as the uploads were marked as translations that were published
> | elsewhere, they fall under a separate copyright regime: those imports
> | will retain their original copyright license. The BSD licence only
> | applies to translations that are (as far as the system knows) original
> | to Launchpad.
> `----
>
> So, my understanding is: Git's code, and strings, would remain what
> they are, but things contributed _through launchpad_ would be BSD.

Ah yes. It seems as if Git's strings and derived works would be marked
GPL-2. That sounds good. Like I said I hadn't looked in any of this in
detail, or the legal issues involved.

Anyway, the main issue with Launchpad that I've had as a
user/translator is getting translations back out of the system. To
download a *.po file you have to log in and submit a request for a
*.po file download. Sometimes it can take hours for you to get a mail
back.

Downloading a large amount of translations through this system in
Launchpad would be very painful. But maybe they have a better API now
that we could use.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls
  2010-08-30 21:28 ` [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls Ævar Arnfjörð Bjarmason
@ 2010-08-31 14:51   ` Jonathan Nieder
  2010-08-31 16:36     ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 14:51 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> +++ b/Makefile
> @@ -2008,10 +2008,11 @@ cscope:
>  	$(RM) cscope*
>  	$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
>  
> +XGETTEXT_OPTIONS = --add-comments
>  pot:
> -	$(XGETTEXT) --add-comments --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
> -	$(XGETTEXT) --add-comments --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
> -	$(XGETTEXT) --add-comments --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
> +	$(XGETTEXT) $(XGETTEXT_OPTIONS) --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
> +	$(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
> +	$(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl

The long lines are a bit scary. :)

Maybe more of it could be pulled out into variables.  As a
side-effect, users could override some settings from the command line.
Maybe something like this?

 LOCALIZED_C = $(C_OBJ:o=c) t/t0200/test.c
 LOCALIZED_SH = $(SCRIPT_SH) t/t0200/test.sh
 LOCALIZED_PERL = $(SCRIPT_PERL) t/t0200/test.perl

 XGETTEXT_OPTIONS = --add-comments
 XGETTEXT_OPTIONS_C = $(XGETTEXT_OPTIONS) -k_ -kN_ -LC
 XGETTEXT_OPTIONS_SH = $(XGETTEXT_OPTIONS) -LShell
 XGETTEXT_OPTIONS_PERL = $(XGETTEXT_OPTIONS) -k__ -LPerl

 po/git.pot:
	rm -f $@+
	$(XGETTEXT) -o$@+ $(XGETTEXT_OPTIONS_C) $(LOCALIZED_C)
	$(XGETTEXT) -j -o$@+ $(XGETTEXT_OPTIONS_SH) $(LOCALIZED_SH)
	$(XGETTEXT) -j -o$@+ $(XGETTEXT_OPTIONS_PERL) $(LOCALIZED_PERL)
	mv $@+ $@

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-30 21:28 ` [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable Ævar Arnfjörð Bjarmason
@ 2010-08-31 15:03   ` Jonathan Nieder
  2010-08-31 15:37     ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:03 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> --- a/builtin/init-db.c
> +++ b/builtin/init-db.c
> @@ -31,7 +31,7 @@ static void safe_create_dir(const char *dir, int share)
>  		}
>  	}
>  	else if (share && adjust_shared_perm(dir))
> -		die("Could not make %s writable by group", dir);
> +		die(_("Could not make %s writable by group"), dir);

Sensible.

I wonder if die() should not just be taught to automatically look up
translations for its format string (could gettext handle that?).

Although we try not to change plumbing error messages without good
reason, details of error messages change often enough that imvho
scripts should not be relying on them.

> -				die_errno("cannot stat '%s'", path);
> +				die_errno(_("cannot stat '%s'"), path);

Will strerror() cope correctly without LC_CTYPE set up?  (Not part
of this series, just something I was reminded of.)

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 06/17] gettext: localize the main git-init message
  2010-08-30 21:28 ` [PATCH/RFC 06/17] gettext: localize the main git-init message Ævar Arnfjörð Bjarmason
@ 2010-08-31 15:10   ` Jonathan Nieder
  2010-08-31 15:39     ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:10 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> Note that the TRANSLATORS comment doesn't use the usual Git
> style. This is because everything from "/* TRANSLATORS: " to "*/" will
> extracted as-is xgettext(1) and presented to translators, including
> newlines and leading "*"'s.

How would it cope with the following?

	/* TRANSLATORS:
	 * The first '%s' is either "Reinitialized existing" or
	 * "Initialized empty", the second " shared" or "", and
	 * the last '%s%s' is the verbatim directory name.
	 */

The leading column of stars makes it easier to distinguish code
from comments.  (Plus I am not too happy to read code with two
inconsistent comment styles used.)

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-30 21:28 ` [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "") Ævar Arnfjörð Bjarmason
@ 2010-08-31 15:18   ` Jonathan Nieder
  2010-08-31 15:37     ` Marcin Cieslak
  2010-08-31 16:51     ` Ævar Arnfjörð Bjarmason
  0 siblings, 2 replies; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:18 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> In 107880a I removed our use of setlocale(LC_CTYPE, "") because of a
> bug in the GNU C Library [1]

Future readers might benefit from a reminder that it is vsnprintf that
is broken.

Aside, not about this patch: glibc printf can be very convenient for
translators, because of format strings like "%4$s".  Do other common
platforms like FreeBSD and Mingw have something similar?

> --- a/gettext.c
> +++ b/gettext.c
> @@ -17,5 +19,9 @@ extern void git_setup_gettext(void) {
>  	}
>  
>  	(void)setlocale(LC_MESSAGES, "");
> +	(void)setlocale(LC_CTYPE, "");
> +	charset = nl_langinfo(CODESET);
> +	(void)bind_textdomain_codeset("git", charset);
> +	(void)setlocale(LC_CTYPE, "C");

For the curious: we cannot use

	setlocale(LC_CTYPE, "");
	charset = nl_langinfo(CODESET);
	setlocale(LC_CTYPE, "C");
	bind_textdomain_codeset("git", charset);

because nl_langinfo returns a pointer to a static buffer that might
be wiped out by setlocale() iirc.

Thanks.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
  2010-08-30 21:28 ` [PATCH/RFC 15/17] po/is.po: add Icelandic translation Ævar Arnfjörð Bjarmason
@ 2010-08-31 15:29   ` Jonathan Nieder
  2010-08-31 17:01     ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:29 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> --- a/po/is.po
> +++ b/po/is.po
> @@ -11,35 +11,154 @@ msgstr ""
>  "Content-Type: text/plain; charset=UTF-8\n"
>  "Content-Transfer-Encoding: 8bit\n"
>  
> -#: t/t0200/test.c:4
> +#: builtin/init-db.c:34

Is there a diff driver that will ignore these --add-location lines?

Alternatively, would it be possible to get msgmerge and xgettext to
provide the filenames without the line numbers?  My experience is
that most translation diffs are very hard to read because about 80%
noise. :(

Aside from that, this looks good and sane (well, the English part
I can read does).

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
                   ` (18 preceding siblings ...)
  2010-08-31 11:08 ` Peter Krefting
@ 2010-08-31 15:32 ` Jonathan Nieder
  2010-08-31 16:05   ` Ævar Arnfjörð Bjarmason
  19 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:32 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> Now that Git has the infrastructure for translation in next I'm going
> to start submitting patches to make the main porcelain translatable.

I've written some comments on specific patches; the rest looks good
to me.

Thanks for moving this forward.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-31 15:03   ` Jonathan Nieder
@ 2010-08-31 15:37     ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:44       ` Jonathan Nieder
  0 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 15:37 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 15:03, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> --- a/builtin/init-db.c
>> +++ b/builtin/init-db.c
>> @@ -31,7 +31,7 @@ static void safe_create_dir(const char *dir, int share)
>>               }
>>       }
>>       else if (share && adjust_shared_perm(dir))
>> -             die("Could not make %s writable by group", dir);
>> +             die(_("Could not make %s writable by group"), dir);
>
> Sensible.
>
> I wonder if die() should not just be taught to automatically look up
> translations for its format string (could gettext handle that?).

It's always a two step process. First you have to mark the messages
for translation, then you have to call gettext() (or _())on them to
make a lookup in the message catalog.

The only way that could work is if I taught xgettext to extract
strings passed to die(), but then managing the false positives would
probably be more effort than just marking them manually, and it would
be a big load on the translators:

    $ ack 'die\("(.*?)"' --output '$1' *[ch] builtin/*[ch] | sort -u | wc -l
    1153

> Although we try not to change plumbing error messages without good
> reason, details of error messages change often enough that imvho
> scripts should not be relying on them.
>
>> -                             die_errno("cannot stat '%s'", path);
>> +                             die_errno(_("cannot stat '%s'"), path);
>
> Will strerror() cope correctly without LC_CTYPE set up?  (Not part
> of this series, just something I was reminded of.)

My GNU/Linux strerror(3) claims to use LC_MESSAGES, but I didn't test
it.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-31 15:18   ` Jonathan Nieder
@ 2010-08-31 15:37     ` Marcin Cieslak
  2010-08-31 15:49       ` Jonathan Nieder
  2010-08-31 16:51     ` Ævar Arnfjörð Bjarmason
  1 sibling, 1 reply; 55+ messages in thread
From: Marcin Cieslak @ 2010-08-31 15:37 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Ævar Arnfjörð Bjarmason, git, Junio C Hamano,
	Jens Lehmann

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1126 bytes --]

On Tue, 31 Aug 2010, Jonathan Nieder wrote:

> Ævar Arnfjörð Bjarmason wrote:
>
>> In 107880a I removed our use of setlocale(LC_CTYPE, "") because of a
>> bug in the GNU C Library [1]
>
> Future readers might benefit from a reminder that it is vsnprintf that
> is broken.
>
> Aside, not about this patch: glibc printf can be very convenient for
> translators, because of format strings like "%4$s".  Do other common
> platforms like FreeBSD and Mingw have something similar?

Speaking for FreeBSD:

% svn log -r21674 printf.3 
------------------------------------------------------------------------
r21674 | jkh | 1997-01-14 08:31:39 +0100 (wto) | 8 linii

The following patch to lib/libc/stdio implements positional arguments in
a manner consistent with other implementations.  Its done in a way that
adds only a tiny amount of overhead when positional arguments are not used.
I also have a test program to go with this, but don't know where it belongs
in the tree.

Submitted-By: Bill Fenner <fenner@FreeBSD.ORG>

------------------------------------------------------------------------

Solaris 9 has it, too.

--Marcin

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 06/17] gettext: localize the main git-init message
  2010-08-31 15:10   ` Jonathan Nieder
@ 2010-08-31 15:39     ` Ævar Arnfjörð Bjarmason
  2010-08-31 15:48       ` Jonathan Nieder
  0 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 15:39 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 15:10, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> Note that the TRANSLATORS comment doesn't use the usual Git
>> style. This is because everything from "/* TRANSLATORS: " to "*/" will
>> extracted as-is xgettext(1) and presented to translators, including
>> newlines and leading "*"'s.
>
> How would it cope with the following?
>
>        /* TRANSLATORS:
>         * The first '%s' is either "Reinitialized existing" or
>         * "Initialized empty", the second " shared" or "", and
>         * the last '%s%s' is the verbatim directory name.
>         */
>
> The leading column of stars makes it easier to distinguish code
> from comments.  (Plus I am not too happy to read code with two
> inconsistent comment styles used.)

As I was (trying) to get across in the the commit message it'll make
the *'s part of the message. I.e.:

    TRANSLATORS: * The first '%s' is either "Reinitialized existing"
    or * "Initialized empty", the second " shared" or "", and * the
    last '%s%s' is the verbatim directory name.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-31 15:37     ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 15:44       ` Jonathan Nieder
  2010-08-31 16:05         ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:44 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> The only way that could work is if I taught xgettext to extract
> strings passed to die(), but then managing the false positives would
> probably be more effort than just marking them manually, and it would
> be a big load on the translators:
> 
>     $ ack 'die\("(.*?)"' --output '$1' *[ch] builtin/*[ch] | sort -u | wc -l
>     1153

To pursue this a little further: would there be any false positives?

We could avoid overwhelming translators by waiting until a file has
been fulling gettextized before allowing xgettext to scavenge it
(i.e., temporarily using a hard-coded list of files in the xgettext
invocation).

>> Will strerror() cope correctly without LC_CTYPE set up?  (Not part
>> of this series, just something I was reminded of.)
>
> My GNU/Linux strerror(3) claims to use LC_MESSAGES, but I didn't test
> it.

Sounds like no, then.

$ cat foo.c
#include <stdio.h>
#include <locale.h>
#include <errno.h>

int main(void)
{
        setlocale(LC_ALL, "");
        setlocale(LC_CTYPE, "C");
        errno = ENODEV;
        perror("test");
        return 0;
}
$ make foo
cc     foo.c   -o foo
$ ./foo
test: No such device
$ LANG=de_DE.UTF-8 ./foo 
test: Kein passendes Ger?t gefunden

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 06/17] gettext: localize the main git-init message
  2010-08-31 15:39     ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 15:48       ` Jonathan Nieder
  0 siblings, 0 replies; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:48 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:
>> Ævar Arnfjörð Bjarmason wrote:

>>> This is because everything from "/* TRANSLATORS: " to "*/" will
>>> extracted as-is xgettext(1) and presented to translators, including
>>> newlines and leading "*"'s.
[...]
> As I was (trying) to get across in the the commit message it'll make
> the *'s part of the message. I.e.:
> 
>     TRANSLATORS: * The first '%s' is either "Reinitialized existing"
>     or * "Initialized empty", the second " shared" or "", and * the
>     last '%s%s' is the verbatim directory name.

Ah, so you meant "not including newlines but including leading '*''s".

Hmm, this is annoying.  Searching existing projects, it seems that
a lot of people are just not using the TRANSLATORS: feature except
for one-line comments.

Thanks for the explanation.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-31 15:37     ` Marcin Cieslak
@ 2010-08-31 15:49       ` Jonathan Nieder
  0 siblings, 0 replies; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 15:49 UTC (permalink / raw)
  To: Marcin Cieslak
  Cc: Ævar Arnfjörð Bjarmason, git, Junio C Hamano,
	Jens Lehmann

Marcin Cieslak wrote:

> Speaking for FreeBSD:
> 
> % svn log -r21674 printf.3 ------------------------------------------------------------------------
> r21674 | jkh | 1997-01-14 08:31:39 +0100 (wto) | 8 linii
> 
> The following patch to lib/libc/stdio implements positional arguments in
> a manner consistent with other implementations.
[...]
> Solaris 9 has it, too.

Thanks for checking.  That's good to hear.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-31 15:44       ` Jonathan Nieder
@ 2010-08-31 16:05         ` Ævar Arnfjörð Bjarmason
  2010-08-31 16:09           ` Jonathan Nieder
  2010-08-31 16:27           ` Junio C Hamano
  0 siblings, 2 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 16:05 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 15:44, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> The only way that could work is if I taught xgettext to extract
>> strings passed to die(), but then managing the false positives would
>> probably be more effort than just marking them manually, and it would
>> be a big load on the translators:
>>
>>     $ ack 'die\("(.*?)"' --output '$1' *[ch] builtin/*[ch] | sort -u | wc -l
>>     1153
>
> To pursue this a little further: would there be any false positives?

Maybe I can see a few probable plumbing messages here, but probably
nothing that's unmanagable: http://gist.github.com/559255

> We could avoid overwhelming translators by waiting until a file has
> been fulling gettextized before allowing xgettext to scavenge it
> (i.e., temporarily using a hard-coded list of files in the xgettext
> invocation).

Yeah we could go this route. But I'm a bit uneasy about it. The way
I'm doing it now I have to manually look at every message to determine
if it's a porcelain error or not.

But it's easier to accidentally mark something with a filelist like
that, or to mark a future plumbing die message that gets introduced
after a file has made the OK list.

Maybe we should have die_plumbing() and die_porcelain() functions to
indicate the nature of the message, although we could get the same
thing with die() and die(_()) once I'm done.

>>> Will strerror() cope correctly without LC_CTYPE set up?  (Not part
>>> of this series, just something I was reminded of.)
>>
>> My GNU/Linux strerror(3) claims to use LC_MESSAGES, but I didn't test
>> it.
>
> Sounds like no, then.
>
> $ cat foo.c
> #include <stdio.h>
> #include <locale.h>
> #include <errno.h>
>
> int main(void)
> {
>        setlocale(LC_ALL, "");
>        setlocale(LC_CTYPE, "C");
>        errno = ENODEV;
>        perror("test");
>        return 0;
> }
> $ make foo
> cc     foo.c   -o foo
> $ ./foo
> test: No such device
> $ LANG=de_DE.UTF-8 ./foo
> test: Kein passendes Ger?t gefunden

What about with MESSAGES instead of ALL, like we're doing?

    setlocale(LC_MESSAGES, "");
    setlocale(LC_CTYPE, "C");

I don't have a box here with a localized C library to test it on.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 15:32 ` Jonathan Nieder
@ 2010-08-31 16:05   ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 16:05 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 15:32, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> Now that Git has the infrastructure for translation in next I'm going
>> to start submitting patches to make the main porcelain translatable.
>
> I've written some comments on specific patches; the rest looks good
> to me.

I'll try to reply to them all.

> Thanks for moving this forward.

And thanks for your continuing efforts in reviewing all of this.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-31 16:05         ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 16:09           ` Jonathan Nieder
  2010-08-31 16:27           ` Junio C Hamano
  1 sibling, 0 replies; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 16:09 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:
> On Tue, Aug 31, 2010 at 15:44, Jonathan Nieder <jrnieder@gmail.com> wrote:

>> int main(void)
>> {
>>        setlocale(LC_ALL, "");
>>        setlocale(LC_CTYPE, "C");
>>        errno = ENODEV;
>>        perror("test");
>>        return 0;
>> }
>> $ make foo
>> cc     foo.c   -o foo
>> $ ./foo
>> test: No such device
>> $ LANG=de_DE.UTF-8 ./foo
>> test: Kein passendes Ger?t gefunden
>
> What about with MESSAGES instead of ALL, like we're doing?
> 
>     setlocale(LC_MESSAGES, "");
>     setlocale(LC_CTYPE, "C");

Same result, alas.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
  2010-08-31 16:05         ` Ævar Arnfjörð Bjarmason
  2010-08-31 16:09           ` Jonathan Nieder
@ 2010-08-31 16:27           ` Junio C Hamano
  1 sibling, 0 replies; 55+ messages in thread
From: Junio C Hamano @ 2010-08-31 16:27 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Jonathan Nieder, git, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> Maybe we should have die_plumbing() and die_porcelain() functions to
> indicate the nature of the message, although we could get the same
> thing with die() and die(_()) once I'm done.

To me, die() vs die(_()) feels like the lessor of two evils ;-).

Thanks.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls
  2010-08-31 14:51   ` Jonathan Nieder
@ 2010-08-31 16:36     ` Ævar Arnfjörð Bjarmason
  0 siblings, 0 replies; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 16:36 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 14:51, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> +++ b/Makefile
>> @@ -2008,10 +2008,11 @@ cscope:
>>       $(RM) cscope*
>>       $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
>>
>> +XGETTEXT_OPTIONS = --add-comments
>>  pot:
>> -     $(XGETTEXT) --add-comments --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
>> -     $(XGETTEXT) --add-comments --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
>> -     $(XGETTEXT) --add-comments --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
>> +     $(XGETTEXT) $(XGETTEXT_OPTIONS) --keyword=_ --keyword=N_ --output=po/git.pot --language=C $(C_OBJ:o=c) t/t0200/test.c
>> +     $(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --output=po/git.pot --language=Shell $(SCRIPT_SH) t/t0200/test.sh
>> +     $(XGETTEXT) $(XGETTEXT_OPTIONS) --join-existing --keyword=__ --output=po/git.pot --language=Perl $(SCRIPT_PERL) t/t0200/test.perl
>
> The long lines are a bit scary. :)
>
> Maybe more of it could be pulled out into variables.  As a
> side-effect, users could override some settings from the command line.
> Maybe something like this?
>
>  LOCALIZED_C = $(C_OBJ:o=c) t/t0200/test.c
>  LOCALIZED_SH = $(SCRIPT_SH) t/t0200/test.sh
>  LOCALIZED_PERL = $(SCRIPT_PERL) t/t0200/test.perl
>
>  XGETTEXT_OPTIONS = --add-comments
>  XGETTEXT_OPTIONS_C = $(XGETTEXT_OPTIONS) -k_ -kN_ -LC
>  XGETTEXT_OPTIONS_SH = $(XGETTEXT_OPTIONS) -LShell
>  XGETTEXT_OPTIONS_PERL = $(XGETTEXT_OPTIONS) -k__ -LPerl
>
>  po/git.pot:
>        rm -f $@+
>        $(XGETTEXT) -o$@+ $(XGETTEXT_OPTIONS_C) $(LOCALIZED_C)
>        $(XGETTEXT) -j -o$@+ $(XGETTEXT_OPTIONS_SH) $(LOCALIZED_SH)
>        $(XGETTEXT) -j -o$@+ $(XGETTEXT_OPTIONS_PERL) $(LOCALIZED_PERL)
>        mv $@+ $@

Thanks. I worked that into v2.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-31 15:18   ` Jonathan Nieder
  2010-08-31 15:37     ` Marcin Cieslak
@ 2010-08-31 16:51     ` Ævar Arnfjörð Bjarmason
  2010-08-31 22:45       ` Jonathan Nieder
  1 sibling, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 16:51 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann, Johannes Sixt

On Tue, Aug 31, 2010 at 15:18, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> In 107880a I removed our use of setlocale(LC_CTYPE, "") because of a
>> bug in the GNU C Library [1]
>
> Future readers might benefit from a reminder that it is vsnprintf that
> is broken.

I'll work something in about that.

> Aside, not about this patch: glibc printf can be very convenient for
> translators, because of format strings like "%4$s".  Do other common
> platforms like FreeBSD and Mingw have something similar?

I certainly hope so. I was planning on documenting its usage,
Johannes?

>> --- a/gettext.c
>> +++ b/gettext.c
>> @@ -17,5 +19,9 @@ extern void git_setup_gettext(void) {
>>       }
>>
>>       (void)setlocale(LC_MESSAGES, "");
>> +     (void)setlocale(LC_CTYPE, "");
>> +     charset = nl_langinfo(CODESET);
>> +     (void)bind_textdomain_codeset("git", charset);
>> +     (void)setlocale(LC_CTYPE, "C");
>
> For the curious: we cannot use
>
>        setlocale(LC_CTYPE, "");
>        charset = nl_langinfo(CODESET);
>        setlocale(LC_CTYPE, "C");
>        bind_textdomain_codeset("git", charset);
>
> because nl_langinfo returns a pointer to a static buffer that might
> be wiped out by setlocale() iirc.

But I'm hopefully sidestepping that issue by passing it to
bind_textdomain_codeset() right away.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
  2010-08-31 15:29   ` Jonathan Nieder
@ 2010-08-31 17:01     ` Ævar Arnfjörð Bjarmason
  2010-08-31 19:14       ` Erik Faye-Lund
  0 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 17:01 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 15:29, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> --- a/po/is.po
>> +++ b/po/is.po
>> @@ -11,35 +11,154 @@ msgstr ""
>>  "Content-Type: text/plain; charset=UTF-8\n"
>>  "Content-Transfer-Encoding: 8bit\n"
>>
>> -#: t/t0200/test.c:4
>> +#: builtin/init-db.c:34
>
> Is there a diff driver that will ignore these --add-location lines?
>
> Alternatively, would it be possible to get msgmerge and xgettext to
> provide the filenames without the line numbers?  My experience is
> that most translation diffs are very hard to read because about 80%
> noise. :(
>
> Aside from that, this looks good and sane (well, the English part
> I can read does).

Some context, an earlier discussion on this:
http://kerneltrap.org/mailarchive/git/2010/5/30/31415/thread#mid-31415

Removing them will have some negative effects. Gettext uses them for
its message fuzzying logic, and they enable you to jump directly to a
source definition.

I've found that it's easier to just go with the flow as far as the
gettext tools are concerned, and they seem to really like to have
these line numbers in :)

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-30 21:42 ` [PATCH/RFC 00/17] Begin gettextizing Git Junio C Hamano
  2010-08-31  9:02   ` [PATCH] gettext: Make NO_GETTEXT=YesPlease the default in releases Ævar Arnfjörð Bjarmason
@ 2010-08-31 17:18   ` Ævar Arnfjörð Bjarmason
  2010-08-31 18:08     ` Jonathan Nieder
  1 sibling, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 17:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Jonathan Nieder, Marcin Cieslak, Jens Lehmann

On Mon, Aug 30, 2010 at 21:42, Junio C Hamano <gitster@pobox.com> wrote:

> Thanks; will queue them.

There's a v2 available here:
http://github.com/avar/git/tree/gettextize-git-mainporcelain-v2

Or: git://github.com/avar/git.git gettextize-git-mainporcelain-v2

It:

 * contains the "gettext: Make NO_GETTEXT=YesPlease the default in
   releases" patch. Please only apply that to next, not pu.

 * A "Makefile: use variables and shorter lines for xgettext" patch,
   which implements Jonathan's suggestion of using more variables for
   the xgettext invocation.

 * Elaborates on the issues facing us in the "gettext.c: work around
   us not using setlocale(LC_CTYPE, "")" commit message, and mentions
   the perror(3) issue.

I didn't send it to the list because it's a huge series and this is a
little fixup, and I rebased it to inject the Makefile patch early in
the series, which isn't easy to express in a v2 PATCH.

Thanks.

I can also send it to list if you want, but I suspect this is better.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 17:18   ` [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
@ 2010-08-31 18:08     ` Jonathan Nieder
  2010-08-31 18:24       ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 18:08 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Junio C Hamano, git, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> Or: git://github.com/avar/git.git gettextize-git-mainporcelain-v2

Is that against "next"?  For an RFC that's okay, but for a series
that will be part of a release it can be tedious to separate out
(not all topics in "next" necessarily are released, and "next"
traditionally gets rewound after each release).

Comments on the patches:

 Makefile: use variables and shorter lines for xgettext

The -o<whatever> passed to cc isn't usually included in CFLAGS,
and a part of me is similarly uncomfortable with including it in
XGETTEXT_OPTIONS.  Isn't that parameter something that should be
possible to change in the build system independently from the
user's XGETTEXT_OPTIONS preferences?

 gettext.c: work around us not using setlocale(LC_CTYPE, "")

The perror() problem shows up with strerror(), too, of course.
(perror just made for an easier demo.)

 gettext: Make NO_GETTEXT=YesPlease the default in releases

Copy-edits for the notes in INSTALL:

> +       - Git includes EXPERIMENTAL support for localization with gettext
> +         which is currently disabled by default in official Git
> +         releases.

s/EXPERIMENTAL/experimental/?  No need to shout.

I'd also s/currently // since this will not be current after a while.

> +         If you really want to build it you have to specify NO_GETTEXT=
> +         as a Makefile argument. If you're a downstream distributor
> +         please don't do so without consulting with the Git Mailing List
> +         first about the stability of this feature.

Similarly I'd s/really //.  If we want to dissuade people from trying
it out, we should probably do that with more explicit statements.

> +         It's only being included in releases so that source messages can
> +         be marked for translation without resulting in painful and
> +         inevitable merge conflicts between Git's pu branch and the
> +         rest. END WARNING.

Not sure what this means.  Maybe:

 The infrastructure is only included in this release to avoid
 complications in building other work on top of it.  If you turn
 it on, expect breakage.

> +         The primary target is GNU libintl, but the Solaris gettext
>           implementation also works.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 18:08     ` Jonathan Nieder
@ 2010-08-31 18:24       ` Ævar Arnfjörð Bjarmason
  2010-08-31 19:22         ` Jonathan Nieder
  0 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 18:24 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, git, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 18:08, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> Or: git://github.com/avar/git.git gettextize-git-mainporcelain-v2
>
> Is that against "next"?  For an RFC that's okay, but for a series
> that will be part of a release it can be tedious to separate out
> (not all topics in "next" necessarily are released, and "next"
> traditionally gets rewound after each release).

Yes it's against next since it had the gettext series merged and next
is about to be released isn't it? I could base it on something else if
that's appropriate.

> Comments on the patches:
>
>  Makefile: use variables and shorter lines for xgettext
>
> The -o<whatever> passed to cc isn't usually included in CFLAGS,
> and a part of me is similarly uncomfortable with including it in
> XGETTEXT_OPTIONS.  Isn't that parameter something that should be
> possible to change in the build system independently from the
> user's XGETTEXT_OPTIONS preferences?

Maybe, but it'll always be --output=po/git.pot so I saw no reason to
seperate it. Should it be? The -o for the C compiler changes, but the
"make pot" target will always write to po/git.pot.

>  gettext.c: work around us not using setlocale(LC_CTYPE, "")
>
> The perror() problem shows up with strerror(), too, of course.
> (perror just made for an easier demo.)

Yeah, and everything external like that, unfortunately.

>  gettext: Make NO_GETTEXT=YesPlease the default in releases
>
> Copy-edits for the notes in INSTALL:
>
>> +       - Git includes EXPERIMENTAL support for localization with gettext
>> +         which is currently disabled by default in official Git
>> +         releases.
>
> s/EXPERIMENTAL/experimental/?  No need to shout.

OKEY THEN!

> I'd also s/currently // since this will not be current after a while.

ok.

>> +         If you really want to build it you have to specify NO_GETTEXT=
>> +         as a Makefile argument. If you're a downstream distributor
>> +         please don't do so without consulting with the Git Mailing List
>> +         first about the stability of this feature.
>
> Similarly I'd s/really //.  If we want to dissuade people from trying
> it out, we should probably do that with more explicit statements.

Thanks.

>> +         It's only being included in releases so that source messages can
>> +         be marked for translation without resulting in painful and
>> +         inevitable merge conflicts between Git's pu branch and the
>> +         rest. END WARNING.
>
> Not sure what this means.  Maybe:
>
>  The infrastructure is only included in this release to avoid
>  complications in building other work on top of it.  If you turn
>  it on, expect breakage.

Yes, that's better. I've worked all these into a
gettextize-git-mainporcelain-v3 branch at the same repository:

    http://github.com/avar/git/compare/gettextize-git-mainporcelain-v2...gettextize-git-mainporcelain-v3

Or: git://github.com/avar/git.git gettextize-git-mainporcelain-v3

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
  2010-08-31 17:01     ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 19:14       ` Erik Faye-Lund
  2010-08-31 19:32         ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Erik Faye-Lund @ 2010-08-31 19:14 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Jonathan Nieder, git, Junio C Hamano, Marcin Cieslak,
	Jens Lehmann

On Tue, Aug 31, 2010 at 7:01 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> On Tue, Aug 31, 2010 at 15:29, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Ævar Arnfjörð Bjarmason wrote:
>>
>>> --- a/po/is.po
>>> +++ b/po/is.po
>>> @@ -11,35 +11,154 @@ msgstr ""
>>>  "Content-Type: text/plain; charset=UTF-8\n"
>>>  "Content-Transfer-Encoding: 8bit\n"
>>>
>>> -#: t/t0200/test.c:4
>>> +#: builtin/init-db.c:34
>>
>> Is there a diff driver that will ignore these --add-location lines?
>>
>> Alternatively, would it be possible to get msgmerge and xgettext to
>> provide the filenames without the line numbers?  My experience is
>> that most translation diffs are very hard to read because about 80%
>> noise. :(
>>
>> Aside from that, this looks good and sane (well, the English part
>> I can read does).
>
> Some context, an earlier discussion on this:
> http://kerneltrap.org/mailarchive/git/2010/5/30/31415/thread#mid-31415
>

msgmerge and xgettext does seem to have the --no-location flag to
avoid these annotations from being generated. The documentation does
say "Note that using this option makes it harder for technically
skilled translators to understand each message's context. ", though.
But perhaps the annotated versions could be generated when needed and
never checked-in (similar to what you suggested in that e-mail)? It
sounds to me like that would give us the best of all worlds. If it's
possible, that is.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 18:24       ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 19:22         ` Jonathan Nieder
  2010-08-31 19:35           ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 19:22 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Junio C Hamano, git, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:

> Maybe, but it'll always be --output=po/git.pot so I saw no reason to
> seperate it. Should it be?

No big deal.  I am vaguely worried about interrupted "make"
invocations.  Don't gettextized packages typically do something like this?

	remove_creation_date() {
		sed '#!/bin/sed -f
			/^"POT-Creation-Date: .*"$/!b
			x
			# Test if the hold space is empty.
			s/P/P/
			ta
			# Yes it was empty. First occurrence. Remove the line.
			g
			d
			bb
			:a
			# The hold space was nonempty. Following occurrences. Do nothing.
			x
			:b'
	}
	(cd po && xgettext --default-domain=git ...)
	set -e; \
	if test -f po/git.pot &&
		remove_creation_date <po/git.pot >po/git.1po+ &&
		remove_creation_date <po/git.po >po/git.2po+ &&
		cmp po/git.1po+ po/git.2po+; \
	then \
		rm -f po/git.1po+ po/git.2po+ po/git.po; \
	else \
		rm -f po/git.1po+ po/git.2po+ po/git.pot; \
		mv po/git.po po/git.pot; \
	fi

> The -o for the C compiler changes, but the
> "make pot" target will always write to po/git.pot.

In particular, to avoid using a partial .pot file, one might want to write to
po/git.pot+, po/git.po, or similar and then rename it.

> Or: git://github.com/avar/git.git gettextize-git-mainporcelain-v3

Looks good.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
  2010-08-31 19:14       ` Erik Faye-Lund
@ 2010-08-31 19:32         ` Ævar Arnfjörð Bjarmason
  2010-08-31 19:49           ` Erik Faye-Lund
  0 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 19:32 UTC (permalink / raw)
  To: kusmabite
  Cc: Jonathan Nieder, git, Junio C Hamano, Marcin Cieslak,
	Jens Lehmann

On Tue, Aug 31, 2010 at 19:14, Erik Faye-Lund <kusmabite@gmail.com> wrote:
> On Tue, Aug 31, 2010 at 7:01 PM, Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>> On Tue, Aug 31, 2010 at 15:29, Jonathan Nieder <jrnieder@gmail.com> wrote:
>>> Ævar Arnfjörð Bjarmason wrote:
>>>
>>>> --- a/po/is.po
>>>> +++ b/po/is.po
>>>> @@ -11,35 +11,154 @@ msgstr ""
>>>>  "Content-Type: text/plain; charset=UTF-8\n"
>>>>  "Content-Transfer-Encoding: 8bit\n"
>>>>
>>>> -#: t/t0200/test.c:4
>>>> +#: builtin/init-db.c:34
>>>
>>> Is there a diff driver that will ignore these --add-location lines?
>>>
>>> Alternatively, would it be possible to get msgmerge and xgettext to
>>> provide the filenames without the line numbers?  My experience is
>>> that most translation diffs are very hard to read because about 80%
>>> noise. :(
>>>
>>> Aside from that, this looks good and sane (well, the English part
>>> I can read does).
>>
>> Some context, an earlier discussion on this:
>> http://kerneltrap.org/mailarchive/git/2010/5/30/31415/thread#mid-31415
>>
>
> msgmerge and xgettext does seem to have the --no-location flag to
> avoid these annotations from being generated. The documentation does
> say "Note that using this option makes it harder for technically
> skilled translators to understand each message's context. ", though.
> But perhaps the annotated versions could be generated when needed and
> never checked-in (similar to what you suggested in that e-mail)? It
> sounds to me like that would give us the best of all worlds. If it's
> possible, that is.

It's certainly possible. But each time you worked with these files
you'd have add the line numbers yourself to generate the context, then
translate, then remove them again, then submit your patch.

I just think it's overly tedious work for getting smaller diffs.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 19:22         ` Jonathan Nieder
@ 2010-08-31 19:35           ` Ævar Arnfjörð Bjarmason
  2010-08-31 19:42             ` Jonathan Nieder
  0 siblings, 1 reply; 55+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-08-31 19:35 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, git, Marcin Cieslak, Jens Lehmann

On Tue, Aug 31, 2010 at 19:22, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>
>> Maybe, but it'll always be --output=po/git.pot so I saw no reason to
>> seperate it. Should it be?
>
> No big deal.  I am vaguely worried about interrupted "make"
> invocations.  Don't gettextized packages typically do something like this?
>
>        remove_creation_date() {
>                sed '#!/bin/sed -f
>                        /^"POT-Creation-Date: .*"$/!b
>                        x
>                        # Test if the hold space is empty.
>                        s/P/P/
>                        ta
>                        # Yes it was empty. First occurrence. Remove the line.
>                        g
>                        d
>                        bb
>                        :a
>                        # The hold space was nonempty. Following occurrences. Do nothing.
>                        x
>                        :b'
>        }
>        (cd po && xgettext --default-domain=git ...)
>        set -e; \
>        if test -f po/git.pot &&
>                remove_creation_date <po/git.pot >po/git.1po+ &&
>                remove_creation_date <po/git.po >po/git.2po+ &&
>                cmp po/git.1po+ po/git.2po+; \
>        then \
>                rm -f po/git.1po+ po/git.2po+ po/git.po; \
>        else \
>                rm -f po/git.1po+ po/git.2po+ po/git.pot; \
>                mv po/git.po po/git.pot; \
>        fi
>
>> The -o for the C compiler changes, but the
>> "make pot" target will always write to po/git.pot.
>
> In particular, to avoid using a partial .pot file, one might want to write to
> po/git.pot+, po/git.po, or similar and then rename it.

I don't know what they usually do. But that looks like a lot of work
to work around a very rare potential edge case. "make pot" is only
ever run manually by a translator right before msgmerge.

In the very rare case where make is interrupted and git.pot is left in
a partial state you'll notice because your msgmerge fails.

>> Or: git://github.com/avar/git.git gettextize-git-mainporcelain-v3
>
> Looks good.

Thanks for checking it out.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 00/17] Begin gettextizing Git
  2010-08-31 19:35           ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 19:42             ` Jonathan Nieder
  0 siblings, 0 replies; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 19:42 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Junio C Hamano, git, Marcin Cieslak, Jens Lehmann

Ævar Arnfjörð Bjarmason wrote:
> On Tue, Aug 31, 2010 at 19:22, Jonathan Nieder <jrnieder@gmail.com> wrote:

>>        if test -f po/git.pot &&
>>                remove_creation_date <po/git.pot >po/git.1po+ &&
>>                remove_creation_date <po/git.po >po/git.2po+ &&
>>                cmp po/git.1po+ po/git.2po+; \
>>        then \
>>                rm -f po/git.1po+ po/git.2po+ po/git.po; \
>>        else \
>>                rm -f po/git.1po+ po/git.2po+ po/git.pot; \
>>                mv po/git.po po/git.pot; \
>>        fi
[...]
> I don't know what they usually do. But that looks like a lot of work
> to work around a very rare potential edge case.

Ah, to work around the interrupted build case is simpler.  grepping for
"mv" in Documentation/Makefile would show some examples.

The above incantation is to avoid changing the timestamp on the .pot
file when it does not change.

> "make pot" is only
> ever run manually by a translator right before msgmerge.

I don't know enough about translation workflows.  Don't people
sometimes automatically run msgmerge at build time to get some okay
fuzzy messages when the translation team is off on vacation?

> Thanks for checking it out.

Thanks for doing the hard work.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
  2010-08-31 19:32         ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 19:49           ` Erik Faye-Lund
  0 siblings, 0 replies; 55+ messages in thread
From: Erik Faye-Lund @ 2010-08-31 19:49 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: Jonathan Nieder, git, Junio C Hamano, Marcin Cieslak,
	Jens Lehmann

On Tue, Aug 31, 2010 at 9:32 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> On Tue, Aug 31, 2010 at 19:14, Erik Faye-Lund <kusmabite@gmail.com> wrote:
>> On Tue, Aug 31, 2010 at 7:01 PM, Ævar Arnfjörð Bjarmason
>> <avarab@gmail.com> wrote:
>>> On Tue, Aug 31, 2010 at 15:29, Jonathan Nieder <jrnieder@gmail.com> wrote:
>>>> Ævar Arnfjörð Bjarmason wrote:
>>>>
>>>>> --- a/po/is.po
>>>>> +++ b/po/is.po
>>>>> @@ -11,35 +11,154 @@ msgstr ""
>>>>>  "Content-Type: text/plain; charset=UTF-8\n"
>>>>>  "Content-Transfer-Encoding: 8bit\n"
>>>>>
>>>>> -#: t/t0200/test.c:4
>>>>> +#: builtin/init-db.c:34
>>>>
>>>> Is there a diff driver that will ignore these --add-location lines?
>>>>
>>>> Alternatively, would it be possible to get msgmerge and xgettext to
>>>> provide the filenames without the line numbers?  My experience is
>>>> that most translation diffs are very hard to read because about 80%
>>>> noise. :(
>>>>
>>>> Aside from that, this looks good and sane (well, the English part
>>>> I can read does).
>>>
>>> Some context, an earlier discussion on this:
>>> http://kerneltrap.org/mailarchive/git/2010/5/30/31415/thread#mid-31415
>>>
>>
>> msgmerge and xgettext does seem to have the --no-location flag to
>> avoid these annotations from being generated. The documentation does
>> say "Note that using this option makes it harder for technically
>> skilled translators to understand each message's context. ", though.
>> But perhaps the annotated versions could be generated when needed and
>> never checked-in (similar to what you suggested in that e-mail)? It
>> sounds to me like that would give us the best of all worlds. If it's
>> possible, that is.
>
> It's certainly possible. But each time you worked with these files
> you'd have add the line numbers yourself to generate the context, then
> translate, then remove them again, then submit your patch.
>
> I just think it's overly tedious work for getting smaller diffs.
>

You know, computers are pretty good at automating tedious jobs ;)

I was thinking something along the lines of having po/is.po etc, and
generating po/is.ann.po (or something) from these (+source) so
translators can see the text in the context of the code. That is, they
edit is.po, and generate is.ann.po when they want to see the context.
Then we can put *.ann.po in .gitignore, and it's really just a matter
of editing, doing "make po/is.ann.po", and voila.

But I dunno, I haven't been using these tools much myself.

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-31 16:51     ` Ævar Arnfjörð Bjarmason
@ 2010-08-31 22:45       ` Jonathan Nieder
  2010-08-31 22:58         ` Erik Faye-Lund
  0 siblings, 1 reply; 55+ messages in thread
From: Jonathan Nieder @ 2010-08-31 22:45 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason
  Cc: git, Junio C Hamano, Marcin Cieslak, Jens Lehmann, Johannes Sixt

Ævar Arnfjörð Bjarmason wrote:
> On Tue, Aug 31, 2010 at 15:18, Jonathan Nieder <jrnieder@gmail.com> wrote:

>> Aside, not about this patch: glibc printf can be very convenient for
>> translators, because of format strings like "%4$s".  Do other common
>> platforms like FreeBSD and Mingw have something similar?
>
> I certainly hope so. I was planning on documenting its usage,
> Johannes?

Sorry, my knowledge was just outdated.  It's in posix[1] now, which
I think means we can expect it to be in any recent libc.

Unfortunately msys uses newlib 1.9.0 afaict, from 2001.  The %4$s
support was introduced[2] to newlib by Eric Blake on 2007-04-25.

[1] http://www.opengroup.org/onlinepubs/9699919799/functions/printf.html#tag_16_159_03
[2] http://sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/stdio/vfprintf.c?cvsroot=src

^ permalink raw reply	[flat|nested] 55+ messages in thread

* Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
  2010-08-31 22:45       ` Jonathan Nieder
@ 2010-08-31 22:58         ` Erik Faye-Lund
  0 siblings, 0 replies; 55+ messages in thread
From: Erik Faye-Lund @ 2010-08-31 22:58 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Ævar Arnfjörð, git, Junio C Hamano, Marcin Cieslak,
	Jens Lehmann, Johannes Sixt

On Wed, Sep 1, 2010 at 12:45 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>> On Tue, Aug 31, 2010 at 15:18, Jonathan Nieder <jrnieder@gmail.com> wrote:
>
>>> Aside, not about this patch: glibc printf can be very convenient for
>>> translators, because of format strings like "%4$s".  Do other common
>>> platforms like FreeBSD and Mingw have something similar?
>>
>> I certainly hope so. I was planning on documenting its usage,
>> Johannes?
>
> Sorry, my knowledge was just outdated.  It's in posix[1] now, which
> I think means we can expect it to be in any recent libc.
>
> Unfortunately msys uses newlib 1.9.0 afaict, from 2001.  The %4$s
> support was introduced[2] to newlib by Eric Blake on 2007-04-25.
>

Git for Windows doesn't use the MSYS-runtime for Git itself, it only
use the MSYS-environment to build etc. It's using MSVCRT.DLL as the
CRT, which is even worse feature-wise.

http://msdn.microsoft.com/en-us/library/56e442dc.aspx describes the
format specification fields supported, and it does not look promising.

^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2010-08-31 22:58 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls Ævar Arnfjörð Bjarmason
2010-08-31 14:51   ` Jonathan Nieder
2010-08-31 16:36     ` Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 02/17] Makefile: provide a --msgid-bugs-address to xgettext(1) Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 03/17] Makefile: tell xgettext(1) that our source is in UTF-8 Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 04/17] builtin.h: Include gettext.h Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable Ævar Arnfjörð Bjarmason
2010-08-31 15:03   ` Jonathan Nieder
2010-08-31 15:37     ` Ævar Arnfjörð Bjarmason
2010-08-31 15:44       ` Jonathan Nieder
2010-08-31 16:05         ` Ævar Arnfjörð Bjarmason
2010-08-31 16:09           ` Jonathan Nieder
2010-08-31 16:27           ` Junio C Hamano
2010-08-30 21:28 ` [PATCH/RFC 06/17] gettext: localize the main git-init message Ævar Arnfjörð Bjarmason
2010-08-31 15:10   ` Jonathan Nieder
2010-08-31 15:39     ` Ævar Arnfjörð Bjarmason
2010-08-31 15:48       ` Jonathan Nieder
2010-08-30 21:28 ` [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "") Ævar Arnfjörð Bjarmason
2010-08-31 15:18   ` Jonathan Nieder
2010-08-31 15:37     ` Marcin Cieslak
2010-08-31 15:49       ` Jonathan Nieder
2010-08-31 16:51     ` Ævar Arnfjörð Bjarmason
2010-08-31 22:45       ` Jonathan Nieder
2010-08-31 22:58         ` Erik Faye-Lund
2010-08-30 21:28 ` [PATCH/RFC 08/17] gettext tests: test if $VERSION exists before using it Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 09/17] gettext tests: update test/is.po to match t/t0200/test.c Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 10/17] gettext tests: add detection for is_IS.ISO-8859-1 locale Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 11/17] gettext tests: test message re-encoding under Shell Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 12/17] gettext tests: test re-encoding with a UTF-8 msgid " Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 13/17] gettext tests: mark a test message as not needing translation Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 14/17] po/is.po: msgmerge and add Language: header Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 15/17] po/is.po: add Icelandic translation Ævar Arnfjörð Bjarmason
2010-08-31 15:29   ` Jonathan Nieder
2010-08-31 17:01     ` Ævar Arnfjörð Bjarmason
2010-08-31 19:14       ` Erik Faye-Lund
2010-08-31 19:32         ` Ævar Arnfjörð Bjarmason
2010-08-31 19:49           ` Erik Faye-Lund
2010-08-30 21:28 ` [PATCH/RFC 16/17] po/pl.po: add Polish translation Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 17/17] gettext tests: test message re-encoding under C Ævar Arnfjörð Bjarmason
2010-08-30 21:42 ` [PATCH/RFC 00/17] Begin gettextizing Git Junio C Hamano
2010-08-31  9:02   ` [PATCH] gettext: Make NO_GETTEXT=YesPlease the default in releases Ævar Arnfjörð Bjarmason
2010-08-31 17:18   ` [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
2010-08-31 18:08     ` Jonathan Nieder
2010-08-31 18:24       ` Ævar Arnfjörð Bjarmason
2010-08-31 19:22         ` Jonathan Nieder
2010-08-31 19:35           ` Ævar Arnfjörð Bjarmason
2010-08-31 19:42             ` Jonathan Nieder
2010-08-31 11:08 ` Peter Krefting
2010-08-31 11:42   ` Ævar Arnfjörð Bjarmason
2010-08-31 11:48     ` Peter Krefting
2010-08-31 12:02     ` Matthieu Moy
2010-08-31 12:43       ` Ævar Arnfjörð Bjarmason
2010-08-31 15:32 ` Jonathan Nieder
2010-08-31 16:05   ` Ævar Arnfjörð Bjarmason

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).