git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 10, 2010, 23:16 UTC
Message-ID
<AANLkTimhR5UDCM_T+UeO=7pbAubR4L6dW4TmUV3B07Pn@mail.gmail.com>
In-Reply-To
<7v62ydgpvs.fsf@alter.siamese.dyndns.org>
On Fri, Sep 10, 2010 at 23:06, Junio C Hamano <gitster@pobox.com> wrote:
Show 31 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
>> ...
>>> +        static const char *reset_type_names[] = {
>>> +            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
>>> +        };
>>> +
>>> +    And then, later:
>>> +
>>> +        die(_("%s reset is not allowed in a bare repository"),
>>> +               _(reset_type_names[reset_type]));
>>
>> I do not think this is a very good example.  Unless we are doing l10n of
>> option names, a Portuguese won't be typing "git reset --misto", so there
>> is no point in invoking _(reset_type_names[]) to begin with, and there is
>> no need to mark mixed/soft/hard/... for translation.
>
> Ahh, I think I should take half of what I said back.  The line of thought
> here is that
>
>  (1) the user types "git reset --mixed"; no l10n of option names;
>
>  (2) however, various modes of operations in "reset" command have
>     human-readable names, not necessarily cuttable-and-pastable for
>     machine consumption.  E.g. "git reset --mixed" is called "mixed
>     reset" in English and that is primarily meant to be explanation of
>     concept in human language, i.e. should be translated.
>
> Under that assumption, localizing reset_type_names[] in the above may make
> sense.
Yeah.
Show 14 quoted lines
> I said "half of", because I think the example is still problematic if you
> want to translate to a language where "reset" in the fixed part of the
> die() message may need to be spelled differently depending on what
> adjective in reset_type_names[] it takes (or the word order between the
> noun "reset" and the adjective may have to be different depending on what
> the adjective is), so an example may probaby need to be more like:
>
>    static const char *error_msgs[] = {
>        N_("mixed reset is not allowed..."),
>        N_("soft reset is not allowed..."),
>        ...
>    };
>
>    die("%s", _(error_msgs[reset_type]));

That, or we could also solve issues like that to some extent by using the gettext message context, which the limited gettext.h API doesn't support yet, it's probably not useful in this case but in others you could do:

    _("reset-verb", "mixed")
And elsewhere:
    _("reset-noun", "mixed")
And that would turn into:
    msgctxt "reset-verb"
    msgid "mixed"
    msgstr "blandað"
Or something like that.

Anyway, regarding the examples it's the only one of two N_() uses right now, and the builtin/notes.c example is more subtle, and needs more explanation.

So out of lazyness I'd prefer to keep it as-is for now.
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 43 of 47 in “[CONTINUE] Add gettext support to Git”
  1. 00/20 [CONTINUE] Add gettext support to GitÆvar Arnfjörð Bjarmason, Sep 7, 2010
  2. 01/20 gettextize: git-clean clean.requireForce bracesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  3. 02/20 gettextize: git-clone "Cloning into" message bracesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  4. 04/20 Makefile: add GNU_GETTEXT, set when we expect GNU gettextÆvar Arnfjörð Bjarmason, Sep 7, 2010
  5. 05/20 Makefile: MSGFMT="msgfmt --check" under GNU_GETTEXTÆvar Arnfjörð Bjarmason, Sep 7, 2010
  6. 06/20 Revert "gettextize: git-revert mark the "me" variable for translation"Ævar Arnfjörð Bjarmason, Sep 7, 2010
  7. 07/20 gettextize: git-revert "Your local changes" messageÆvar Arnfjörð Bjarmason, Sep 7, 2010
  8. 08/20 gettextize: git-revert literal "me" messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  9. 09/20 gettext: add GETTEXT_POISON support for shell scriptsÆvar Arnfjörð Bjarmason, Sep 7, 2010
  10. 10/20 gettext: add GETTEXT_POISON tests for shell scriptsÆvar Arnfjörð Bjarmason, Sep 7, 2010
  11. 11/20 gettextize: git-am add git-sh-i18nÆvar Arnfjörð Bjarmason, Sep 7, 2010
  12. 12/20 gettextize: git-am one-line gettext $msg; echoÆvar Arnfjörð Bjarmason, Sep 7, 2010
  13. 13/20 gettextize: git-am multi-line getttext $msg; echoÆvar Arnfjörð Bjarmason, Sep 7, 2010
  14. 14/20 gettextize: git-am eval_gettext messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  15. 15/20 gettextize: git-am die messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  16. 16/20 gettextize: git-am cannot_fallback messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  17. 17/20 gettextize: git-am clean_abort messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  18. 18/20 gettextize: git-am "Apply?" messageÆvar Arnfjörð Bjarmason, Sep 7, 2010
  19. 19/20 gettextize: git-am core say messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  20. 20/20 gettextize: git-am printf(1) message to eval_gettextÆvar Arnfjörð Bjarmason, Sep 7, 2010
  21. Jonathan NiederSep 7, 2010
  22. Ævar Arnfjörð BjarmasonSep 7, 2010
  23. Jonathan NiederSep 7, 2010
  24. 20/20 gettextize: git-am printf(1) message to eval_gettextÆvar Arnfjörð Bjarmason, Sep 7, 2010
  25. 19/20 gettextize: git-am core say messagesÆvar Arnfjörð Bjarmason, Sep 7, 2010
  26. Junio C HamanoSep 8, 2010
  27. Ævar Arnfjörð BjarmasonSep 8, 2010
  28. Ævar Arnfjörð BjarmasonSep 10, 2010
  29. Junio C HamanoSep 10, 2010
  30. Ævar Arnfjörð BjarmasonSep 10, 2010
  31. 0/5 gettext docs: programmer docs in po/READMEÆvar Arnfjörð Bjarmason, Sep 10, 2010
  32. Ævar Arnfjörð BjarmasonSep 10, 2010
  33. 1/5 gettext docs: add a "Testing your changes" section to po/READMEÆvar Arnfjörð Bjarmason, Sep 10, 2010
  34. 2/5 gettext docs: add "Marking strings for translation" section in po/READMEÆvar Arnfjörð Bjarmason, Sep 10, 2010
  35. Junio C HamanoSep 10, 2010
  36. Ævar Arnfjörð BjarmasonSep 10, 2010
  37. 3/5 gettext docs: the gettext.h C interfaceÆvar Arnfjörð Bjarmason, Sep 10, 2010
  38. Junio C HamanoSep 10, 2010
  39. Ævar Arnfjörð BjarmasonSep 10, 2010
  40. Junio C HamanoSep 10, 2010
  41. Ævar Arnfjörð BjarmasonSep 10, 2010
  42. Junio C HamanoSep 10, 2010
  43. Ævar Arnfjörð BjarmasonSep 10, 2010
  44. 4/5 gettext docs: the git-sh-i18n.sh Shell interfaceÆvar Arnfjörð Bjarmason, Sep 10, 2010
  45. Junio C HamanoSep 10, 2010
  46. Ævar Arnfjörð BjarmasonSep 10, 2010
  47. 5/5 gettext docs: the Git::I18N Perl interfaceÆvar Arnfjörð Bjarmason, Sep 10, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.