Begin gettextizing Git
cover Begin gettextizing Git
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
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 1/17 Makefile: A variable for options used by xgettext(1) calls
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.
--- Makefile | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -3
@@ -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))
Signature · 1 line
1.7.2.2.536.g3f548
Re: [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls
Makefile cscope: · line 2015
Quoted 13 lines · Ævar Arnfjörð Bjarmason
+++ b/Makefile
Makefile +4
-3@@ -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 $@+ $@
Re: [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls
Quoted 31 lines · Jonathan Nieder
Quoted 5 lines · Ævar Arnfjörð Bjarmason
+++ b/Makefile
(quoted diff) +0
-0@@ -2008,10 +2008,11 @@ cscope:$(RM) cscope*
$(FIND) . -name '*.[hcS]' -print | xargs cscope -bQuoted 8 lines
+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.perlThe 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.cLOCALIZED_SH= $(SCRIPT_SH)t/t0200/test.shLOCALIZED_PERL= $(SCRIPT_PERL) t/t0200/test.perlXGETTEXT_OPTIONS = --add-comments
XGETTEXT_OPTIONS_C= $(XGETTEXT_OPTIONS) -k_ -kN_ -LCXGETTEXT_OPTIONS_SH= $(XGETTEXT_OPTIONS) -LShellXGETTEXT_OPTIONS_PERL= $(XGETTEXT_OPTIONS) -k__ -LPerl
Quoted 6 lines
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.
PATCH 2/17 Makefile: provide a --msgid-bugs-address to xgettext(1)
In reply to Ævar Arnfjörð BjarmasonChange 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).
--- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -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 <[email protected]>" 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
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 3/17 Makefile: tell xgettext(1) that our source is in UTF-8
In reply to Ævar Arnfjörð BjarmasonBy 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.
--- Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
@@ -2008,7 +2008,7 @@ cscope: $(RM) cscope* $(FIND) . -name '*.[hcS]' -print | xargs cscope -b -XGETTEXT_OPTIONS = --add-comments --msgid-bugs-address="Git Mailing List <[email protected]>" +XGETTEXT_OPTIONS = --add-comments --msgid-bugs-address="Git Mailing List <[email protected]>" --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
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 4/17 builtin.h: Include gettext.h
In reply to Ævar Arnfjörð BjarmasonChange 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.
--- builtin.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
builtin.h +1 -0
@@ -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[];
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 5/17 gettext: make the simple parts of git-init localizable
In reply to Ævar Arnfjörð BjarmasonChange 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.
--- builtin/init-db.c | 46 +++++++++++++++++++++++----------------------- 1 files changed, 23 insertions(+), 23 deletions(-)
builtin/init-db.c +23 -23
@@ -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 ()); }
Signature · 1 line
1.7.2.2.536.g3f548
Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
builtin/init-db.c static void safe_create_dir(const char *dir, int share) · line 34
Quoted 8 lines · Ævar Arnfjörð Bjarmason
builtin/init-db.c +1
-1@@ -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.
builtin/init-db.c static void copy_templates_1(char *path, int baselen, · line 66
Quoted 2 lines
builtin/init-db.c +1
-1-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.)
Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
Quoted 13 lines · Jonathan Nieder
builtin/init-db.c static void safe_create_dir(const char *dir, int share) · line 34
Quoted 8 lines · Ævar Arnfjörð Bjarmason
builtin/init-db.c +1
-1@@ -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.
Quoted 2 lines
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
1153Quoted 9 lines
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.
builtin/init-db.c static void copy_templates_1(char *path, int baselen, · line 66
Quoted 2 lines
builtin/init-db.c +1
-1- die_errno("cannot stat '%s'", path); + die_errno(_("cannot stat '%s'"), path);Will
strerror()cope correctly withoutLC_CTYPEset 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.
Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
Quoted 7 lines · Ævar Arnfjörð Bjarmason
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).
Quoted 5 lines
Quoted 2 lines
Will
strerror()cope correctly withoutLC_CTYPEset 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 gefundenRe: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
Quoted 11 lines · Jonathan Nieder
Quoted 7 lines · Ævar Arnfjörð Bjarmason
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 1153To 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
Quoted 4 lines
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.
Quoted 21 lines
Quoted 5 lines
Quoted 2 lines
Will
strerror()cope correctly withoutLC_CTYPEset 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;
}
Quoted 6 lines
$ 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.
Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
Quoted 17 lines · Ævar Arnfjörð Bjarmason
Quoted 8 lines · Jonathan Nieder
int main(void)
{
setlocale(LC_ALL, "");
setlocale(LC_CTYPE, "C");
errno = ENODEV;
perror("test");
return 0;
}Quoted 6 lines
$ make foo cc foo.c -o foo $ ./foo test: No such device $ LANG=de_DE.UTF-8 ./foo test: Kein passendes Ger?t gefunden
Quoted 4 lines
What about with MESSAGES instead of ALL, like we're doing?
setlocale(LC_MESSAGES, ""); setlocale(LC_CTYPE, "C");
Same result, alas.
Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
In reply to Ævar Arnfjörð BjarmasonQuoted 3 lines · Ævar Arnfjörð Bjarmason
Maybe we should have
die_plumbing()anddie_porcelain()functions to indicate the nature of the message, although we could get the same thing withdie()and die(_()) once I'm done.
To me, die() vs die(_()) feels like the lessor of two evils ;-).
Thanks.
PATCH 6/17 gettext: localize the main git-init message
In reply to Ævar Arnfjörð BjarmasonChange 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.
--- builtin/init-db.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
builtin/init-db.c +7 -3
@@ -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 ] !='/' ?"/" :"" ); }
Signature · 1 line
1.7.2.2.536.g3f548
Re: [PATCH/RFC 06/17] gettext: localize the main git-init message
Quoted 4 lines · Ævar Arnfjörð Bjarmason
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.)
Re: [PATCH/RFC 06/17] gettext: localize the main git-init message
Quoted 15 lines · Jonathan Nieder
Quoted 4 lines · Ævar Arnfjörð Bjarmason
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. */
Quoted 3 lines
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.
Re: [PATCH/RFC 06/17] gettext: localize the main git-init message
Quoted 5 lines · Ævar Arnfjörð Bjarmason
Quoted 5 lines
Quoted 3 lines · Ævar Arnfjörð Bjarmason
This is because everything from "/* TRANSLATORS: " to "*/" will extracted as-is xgettext(1) and presented to translators, including newlines and leading "*"'s.
[...]
Quoted 6 lines
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.
PATCH 7/17 gettext.c: work around us not using setlocale(LC_CTYPE, "")
In reply to Ævar Arnfjörð BjarmasonChange 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
--- gettext.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
gettext.c +6 -0
@@ -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" ); }
Signature · 1 line
1.7.2.2.536.g3f548
Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
Quoted 2 lines · Ævar Arnfjörð Bjarmason
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?
gettext.c extern void git_setup_gettext(void) { · line 25
Quoted 10 lines
gettext.c +4
-0@@ -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.
Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
Quoted 7 lines · Jonathan Nieder
Quoted 2 lines · Ævar Arnfjörð Bjarmason
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.
Quoted 3 lines
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?
Quoted 13 lines
gettext.c extern void git_setup_gettext(void) { · line 25
Quoted 10 lines
gettext.c +4
-0@@ -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
Quoted 7 lines
setlocale(LC_CTYPE, "");
charset =nl_langinfo(CODESET);
setlocale(LC_CTYPE, "C");
bind_textdomain_codeset("git", charset);because
nl_langinforeturns a pointer to a static buffer that might be wiped out bysetlocale()iirc.
But I'm hopefully sidestepping that issue by passing it to bind_textdomain_codeset() right away.
Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 3 lines · Jonathan Nieder
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
Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
Quoted 7 lines · Jonathan Nieder
Quoted 6 lines · Ævar Arnfjörð Bjarmason
Quoted 3 lines · Jonathan Nieder
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?
Quoted 9 lines
Quoted 2 lines
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.
Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
In reply to Jonathan NiederQuoted 11 lines · Jonathan Nieder
Quoted 2 lines · Ævar Arnfjörð Bjarmason
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.
------------------------------------------------------------------------
Solaris 9 has it, too.
--Marcin
Re: [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "")
Quoted 7 lines · Marcin Cieslak
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/stdioimplements positional arguments in a manner consistent with other implementations.
[...]
Quoted 1 line
Solaris 9 has it, too.
Thanks for checking. That's good to hear.
PATCH 8/17 gettext tests: test if $VERSION exists before using it
In reply to Ævar Arnfjörð BjarmasonVersions 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.
--- t/t0202/test.pl | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
t/t0202/test.pl +3 -1
@@ -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'}");
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 9/17 gettext tests: update test/is.po to match t/t0200/test.c
In reply to Ævar Arnfjörð BjarmasonChange 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
--- po/is.po | 4 ++-- t/t0200-gettext-basic.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
po/is.po +2 -2
@@ -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
t/t0200-gettext-basic.sh +2 -2
@@ -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 '
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 10/17 gettext tests: add detection for is_IS.ISO-8859-1 locale
In reply to Ævar Arnfjörð BjarmasonAdd 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.
--- t/lib-gettext.sh | 26 +++++++++++++++++++++++--- 1 files changed, 23 insertions(+), 3 deletions(-)
t/lib-gettext.sh +23 -3
@@ -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
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 11/17 gettext tests: test message re-encoding under Shell
In reply to Ævar Arnfjörð BjarmasonOur 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.
--- 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
po/is.po +12 -0
@@ -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"
t/t0200/test.c +6 -0
@@ -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" )); }
t/t0204-gettext-reencode-sanity.sh new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 12/17 gettext tests: test re-encoding with a UTF-8 msgid under Shell
In reply to Ævar Arnfjörð BjarmasonA 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.
--- po/is.po | 6 ++++++ t/t0200/test.c | 3 +++ t/t0204-gettext-reencode-sanity.sh | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-)
po/is.po +6 -0
@@ -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"
t/t0200/test.c +3 -0
@@ -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" )); }
t/t0204-gettext-reencode-sanity.sh +21 -0
@@ -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
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 13/17 gettext tests: mark a test message as not needing translation
In reply to Ævar Arnfjörð BjarmasonThis was the only message in t/t0200/* that didn't have a TRANSLATORS comment, without it translators will waste time translating this needlessly.
--- t/t0200/test.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
t/t0200/test.c +1 -0
@@ -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 )
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 14/17 po/is.po: msgmerge and add Language: header
In reply to Ævar Arnfjörð BjarmasonChange 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.
--- po/is.po | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
po/is.po +4 -2
@@ -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 <[email protected]>\n" "Report-Msgid-Bugs-To: Git Mailing List <[email protected]>\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 <[email protected]>\n" +"Language-Team: Git Mailing List <[email protected]>\n" +"Language: is\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n"
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 15/17 po/is.po: add Icelandic translation
In reply to Ævar Arnfjörð BjarmasonTranslate the non-TEST messages added in recent patches against init-db.c. This brings Icelandic translation coverage up to 100%.
--- po/is.po | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 127 insertions(+), 8 deletions(-)
po/is.po +127 -8
@@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: Git\n" "Report-Msgid-Bugs-To: Git Mailing List <[email protected]>\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 <[email protected]>\n" "Language-Team: Git Mailing List <[email protected]>\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"
Signature · 1 line
1.7.2.2.536.g3f548
Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
po/is.po msgstr "" · line 14
Quoted 8 lines · Ævar Arnfjörð Bjarmason
po/is.po +1
-1@@ -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).
Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
Quoted 13 lines · Jonathan Nieder
po/is.po msgstr "" · line 14
Quoted 8 lines · Ævar Arnfjörð Bjarmason
po/is.po +0
-0@@ -11,35 +11,154 @@ msgstr """Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"po/is.po +1
-1-#: t/t0200/test.c:4 +#: builtin/init-db.c:34Is there a diff driver that will ignore these --add-location lines?
Quoted 7 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 :)
Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 18 lines · Jonathan Nieder
po/is.po msgstr "" · line 14
Quoted 8 lines · Ævar Arnfjörð Bjarmason
po/is.po +0
-0@@ -11,35 +11,154 @@ msgstr """Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"po/is.po +1
-1-#: t/t0200/test.c:4 +#: builtin/init-db.c:34Is 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. :(
Quoted 6 lines
Quoted 2 lines
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.
Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
Quoted 28 lines · Erik Faye-Lund
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 18 lines · Jonathan Nieder
po/is.po msgstr "" · line 14
Quoted 8 lines · Ævar Arnfjörð Bjarmason
po/is.po +0
-0@@ -11,35 +11,154 @@ msgstr """Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"po/is.po +1
-1-#: t/t0200/test.c:4 +#: builtin/init-db.c:34Is 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. :(
Quoted 6 lines
Quoted 2 lines
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
Quoted 8 lines
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.
Re: [PATCH/RFC 15/17] po/is.po: add Icelandic translation
Quoted 38 lines · Ævar Arnfjörð Bjarmason
Quoted 28 lines · Erik Faye-Lund
Quoted 19 lines · Ævar Arnfjörð Bjarmason
Quoted 18 lines · Jonathan Nieder
po/is.po msgstr "" · line 14
Quoted 8 lines · Ævar Arnfjörð Bjarmason
po/is.po +0
-0@@ -11,35 +11,154 @@ msgstr """Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"po/is.po +1
-1-#: t/t0200/test.c:4 +#: builtin/init-db.c:34Is 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. :(
Quoted 6 lines
Quoted 2 lines
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-31415Quoted 8 lines
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.
Quoted 6 lines
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.
PATCH 16/17 po/pl.po: add Polish translation
In reply to Ævar Arnfjörð BjarmasonFrom: Marcin Cieślak <[email protected]>
Translate all the translatable messages currently in Git, except for the 10 TEST messages that shouldn't be translated.
--- po/pl.po | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 187 insertions(+), 0 deletions(-) create mode 100644 po/pl.po
po/pl.po new file +187 -0
@@ -0,0 +1,187 @@ +msgid "" +msgstr "" +"Project-Id-Version: Git\n" +"Report-Msgid-Bugs-To: Git Mailing List <[email protected]>\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 <[email protected]>\n" +"Language-Team: Git Mailing List <[email protected]>\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 ""
Signature · 1 line
1.7.2.2.536.g3f548
PATCH 17/17 gettext tests: test message re-encoding under C
In reply to Ævar Arnfjörð BjarmasonAdd 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.
--- t/t0204-gettext-reencode-sanity.sh | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
t/t0204-gettext-reencode-sanity.sh +14 -0
@@ -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
Signature · 1 line
1.7.2.2.536.g3f548
Quoted 2 lines · Æ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.
I've written some comments on specific patches; the rest looks good to me.
Thanks for moving this forward.
Quoted 7 lines · Jonathan Nieder
Quoted 2 lines · Æ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.
I've written some comments on specific patches; the rest looks good to me.
I'll try to reply to them all.
Quoted 1 line
Thanks for moving this forward.
And thanks for your continuing efforts in reviewing all of this.
Quoted 8 lines · Æ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.
Quoted 7 lines
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.
PATCH 1/1 gettext: Make NO_GETTEXT=YesPlease the default in releases
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.
---
Quoted 14 lines · Junio C Hamano
Quoted 12 lines · Æ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.
Quoted 5 lines
Quoted 3 lines
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!
Quoted 7 lines
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.
Quoted 4 lines
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(-)
INSTALL +15 -2
@@ -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
Makefile +4 -0
@@ -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
configure.ac +1 -1
@@ -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) #
Signature · 1 line
1.7.2.2.535.g1333f.dirty
Quoted 1 line · Junio C Hamano
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.
Quoted 1 line · Ævar Arnfjörð Bjarmason
Or:
git://github.com/avar/git.gitgettextize-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:
Review
Quoted 3 lines
(quoted diff) +3
-0+ - 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.
Review
Quoted 4 lines
(quoted diff) +4
-0+ 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.
Review
Quoted 4 lines
(quoted diff) +4
-0+ 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.
Quoted 2 lines
+ The primary target is GNU libintl, but the Solaris gettext
implementation also works.
Quoted 8 lines · Jonathan Nieder
Quoted 1 line · Ævar Arnfjörð Bjarmason
Or:
git://github.com/avar/git.gitgettextize-git-mainporcelain-v2Is 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.
Quoted 9 lines
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'sXGETTEXT_OPTIONSpreferences?
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.
Quoted 4 lines
gettext.c: work around us not using
setlocale(LC_CTYPE, "")The
perror()problem shows up withstrerror(), too, of course. (perror just made for an easier demo.)
Yeah, and everything external like that, unfortunately.
Quoted 9 lines
gettext: Make NO_GETTEXT=YesPlease the default in releases
Copy-edits for the notes in INSTALL:
Quoted 3 lines
+ - 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!
Quoted 1 line
I'd also s/currently // since this will not be current after a while.
ok.
Quoted 7 lines
Quoted 4 lines
+ If you really want to build it you have to specify NO_GETTEXT=
+ as aMakefileargument. 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.
Quoted 10 lines
Quoted 4 lines
+ 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
Quoted 2 lines · Ævar Arnfjörð Bjarmason
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; \
fiQuoted 2 lines
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.
Quoted 1 line
Or:
git://github.com/avar/git.gitgettextize-git-mainporcelain-v3
Looks good.
Quoted 37 lines · Jonathan Nieder
Quoted 2 lines · Ævar Arnfjörð Bjarmason
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
Quoted 5 lines
Quoted 2 lines
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.
Quoted 3 lines
Quoted 1 line
Or:
git://github.com/avar/git.gitgettextize-git-mainporcelain-v3Looks good.
Thanks for checking it out.
Quoted 12 lines · Ævar Arnfjörð Bjarmason
Quoted 10 lines · Jonathan Nieder
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
[...]
Quoted 2 lines
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.
Quoted 2 lines
"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?
Quoted 1 line
Thanks for checking it out.
Thanks for doing the hard work.
Ævar Arnfjörð Bjarmason:
Quoted 1 line
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.
Signature · 1 line
\\// Peter - http://www.softwolves.pp.se/
Quoted 8 lines · Peter Krefting
Ævar Arnfjörð Bjarmason:
Quoted 3 lines
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!
Quoted 4 lines
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
Ævar Arnfjörð Bjarmason:
Quoted 1 line
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.
Quoted 1 line
Preferably with an active translation community.
Translation Project is indeed very active.
Quoted 2 lines
http://kerneltrap.org/mailarchive/git/2008/3/14/1163164 Is that the one you're talking about?
Yes.
Quoted 1 line
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.
Signature · 1 line
\\// Peter - http://www.softwolves.pp.se/
Quoted 5 lines · Ævar Arnfjörð Bjarmason
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.
Signature · 2 lines
Matthieu Moy http://www-verimag.imag.fr/~moy/
Quoted 19 lines · Matthieu Moy
Quoted 5 lines · Ęvar Arnfjörš Bjarmason
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.
Quoted 4 lines
`----
So, my understanding is: Git's code, and strings, would remain what they are, but things contributed
_throughlaunchpad_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.