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

Re: [PATCH 12/12] fsck: mark strings for translation

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Oct 29, 2018, 17:38 UTC
Message-ID
<87ftwolkl4.fsf@evledraar.gmail.com>
In-Reply-To
<CACsJy8CE2mi69kXcs2sFYm34txfDb24Qqm4bgv_w3WAcYEEFLg@mail.gmail.com>
On Mon, Oct 29 2018, Duy Nguyen wrote:
Show 25 quoted lines
> On Mon, Oct 29, 2018 at 3:09 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> SZEDER Gábor <szeder.dev@gmail.com> writes:
>>
>> >> -    fprintf(stderr, "%s in %s %s: %s\n",
>> >> -            msg_type, printable_type(obj), describe_object(obj), err);
>> >> +    fprintf_ln(stderr, _("%s in %s %s: %s"),
>> >
>> > Are the (f)printf() -> (f)printf_ln() changes all over
>> > 'builtin/fsck.c' really necessary to mark strings for translation?
>>
>> It is beyond absolute minimum but I saw it argued here that this
>> makes it easier to manage the .po and .pot files if your message
>> strings do not end with LF, a you are much less likely to _add_
>> unneeded LF to the translated string than _lose_ LF at the end of
>> translated string.
>
> Especially when \n plays an important role and we don't trust
> translators to keep it [1] [2]. It's probably a too defensive stance
> and often does not apply, so nowadays I do it just to keep a
> consistent pattern in the code.
>
> [1] https://public-inbox.org/git/20120308220131.GA10122@burratino/#t
> [2] but then translators can crash programs anyway (e.g. changing %d
> to %s...) we just trust gettext tools to catch problems early.

As Jonathan pointed out in the follow-up message[1] this sort of thing is checked for in msgfmt, so sure, let's strip the \n, but it's really not something we need to worry about. Likewise with translators turning "%s" into "%d" (or "% s") or whatever.

    $ git diff -U0
    diff --git a/po/de.po b/po/de.po
    index 47986814c9..62de46c63d 100644
    --- a/po/de.po
    +++ b/po/de.po
    @@ -23 +23 @@ msgid "%shint: %.*s%s\n"
    -msgstr "%sHinweis: %.*s%s\n"
    +msgstr "%sHinweis: %.*s%s"
    $ make [...]
    [...]
    po/de.po:23: 'msgid' and 'msgstr' entries do not both end with '\n'
    msgfmt: found 1 fatal error
    3470 translated messages.
    make: *** [Makefile:2488: po/build/locale/de/LC_MESSAGES/git.mo] Error 1
1. https://public-inbox.org/git/CACsJy8AcUy9FZiiehGc7mEL4i+XP6u0pmH1rGoR-WZnhYT1UMQ@mail.gmail.com/
Previous: Duy NguyenNext: Ævar Arnfjörð Bjarmason
Message 19 of 71 in “Mark more strings for translation”
  1. 00/12 Mark more strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  2. 01/12 git.c: mark more strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  3. 02/12 alias.c: mark split_cmdline_strerror() strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  4. 03/12 archive.c: mark more strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  5. 04/12 attr.c: mark more string for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  6. 05/12 read-cache.c: mark more strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  7. 06/12 read-cache.c: add missing colon separatorsNguyễn Thái Ngọc Duy, Oct 28, 2018
  8. 07/12 reflog: mark strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  9. 09/12 repack: mark more strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  10. 08/12 remote.c: mark messages for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  11. Junio C HamanoOct 29, 2018
  12. Duy NguyenOct 29, 2018
  13. 11/12 parse-options.c: mark more strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  14. 10/12 parse-options: replace opterror() with optname()Nguyễn Thái Ngọc Duy, Oct 28, 2018
  15. 12/12 fsck: mark strings for translationNguyễn Thái Ngọc Duy, Oct 28, 2018
  16. SZEDER GáborOct 29, 2018
  17. Junio C HamanoOct 29, 2018
  18. Duy NguyenOct 29, 2018
  19. Ævar Arnfjörð BjarmasonOct 29, 2018
  20. Ævar Arnfjörð BjarmasonOct 29, 2018
  21. Jiang XinNov 1, 2018
  22. Jonathan NiederOct 30, 2018
  23. Duy NguyenNov 5, 2018
  24. 00/16 Mark more strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  25. 01/16 git.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  26. Junio C HamanoNov 6, 2018
  27. 02/16 alias.c: mark split_cmdline_strerror() strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  28. 03/16 archive.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  29. Junio C HamanoNov 6, 2018
  30. 04/16 attr.c: mark more string for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  31. 05/16 read-cache.c: turn die("internal error") to BUG()Nguyễn Thái Ngọc Duy, Nov 5, 2018
  32. Junio C HamanoNov 6, 2018
  33. 06/16 read-cache.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  34. 07/16 read-cache.c: add missing colon separatorsNguyễn Thái Ngọc Duy, Nov 5, 2018
  35. Junio C HamanoNov 6, 2018
  36. 09/16 remote.c: turn some error() or die() to BUG()Nguyễn Thái Ngọc Duy, Nov 5, 2018
  37. Junio C HamanoNov 6, 2018
  38. 08/16 reflog: mark strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  39. Junio C HamanoNov 6, 2018
  40. 11/16 repack: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  41. 10/16 remote.c: mark messages for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  42. 13/16 parse-options.c: turn some die() to BUG()Nguyễn Thái Ngọc Duy, Nov 5, 2018
  43. Junio C HamanoNov 6, 2018
  44. 14/16 parse-options.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  45. 12/16 parse-options: replace opterror() with optname()Nguyễn Thái Ngọc Duy, Nov 5, 2018
  46. Junio C HamanoNov 6, 2018
  47. Ramsay JonesNov 6, 2018
  48. Jeff KingNov 6, 2018
  49. Duy NguyenNov 10, 2018
  50. Ramsay JonesNov 10, 2018
  51. 15/16 fsck: reduce word legos to help i18nNguyễn Thái Ngọc Duy, Nov 5, 2018
  52. Junio C HamanoNov 6, 2018
  53. Duy NguyenNov 10, 2018
  54. 16/16 fsck: mark strings for translationNguyễn Thái Ngọc Duy, Nov 5, 2018
  55. 00/16 Mark more strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  56. 16/16 fsck: mark strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  57. 03/16 archive.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  58. 02/16 alias.c: mark split_cmdline_strerror() strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  59. 04/16 attr.c: mark more string for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  60. 06/16 read-cache.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  61. 07/16 read-cache.c: add missing colon separatorsNguyễn Thái Ngọc Duy, Nov 10, 2018
  62. 14/16 parse-options.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  63. 01/16 git.c: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  64. 09/16 remote.c: turn some error() or die() to BUG()Nguyễn Thái Ngọc Duy, Nov 10, 2018
  65. 05/16 read-cache.c: turn die("internal error") to BUG()Nguyễn Thái Ngọc Duy, Nov 10, 2018
  66. 12/16 parse-options: replace opterror() with optname()Nguyễn Thái Ngọc Duy, Nov 10, 2018
  67. 10/16 remote.c: mark messages for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  68. 15/16 fsck: reduce word legos to help i18nNguyễn Thái Ngọc Duy, Nov 10, 2018
  69. 13/16 parse-options.c: turn some die() to BUG()Nguyễn Thái Ngọc Duy, Nov 10, 2018
  70. 11/16 repack: mark more strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018
  71. 08/16 reflog: mark strings for translationNguyễn Thái Ngọc Duy, Nov 10, 2018

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.