Re: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 31, 2010, 15:37 UTC
- Message-ID
- <AANLkTikd7mc4DjTVaKip_WFqVdezE13ZbL+Vmfqd8yCu@mail.gmail.com>
- In-Reply-To
- <20100831150301.GE2315@burratino>
On Tue, Aug 31, 2010 at 15:03, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 15 quoted lines
> Æ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
1153Show 9 quoted 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.
>
>> - 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.