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

[PATCH] gettext: Make NO_GETTEXT=YesPlease the default in releases

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 31, 2010, 09:02 UTC
Message-ID
<1283245326-26108-1-git-send-email-avarab@gmail.com>
In-Reply-To
<7v39tveq0j.fsf@alter.siamese.dyndns.org>

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

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

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

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

    #define _(s) (s)

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

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

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

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

 INSTALL      |   17 +++++++++++++++--
 Makefile     |    4 ++++
 configure.ac |    2 +-
 3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/INSTALL b/INSTALL
index e4e7506..aa477e2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -93,8 +93,21 @@ Issues of note:
 	  history graphically, and in git-gui.  If you don't want gitk or
 	  git-gui, you can use NO_TCLTK.
 
-	- A gettext library is used by default for localizing Git. The
-	  primary target is GNU libintl, but the Solaris gettext
+	- Git includes EXPERIMENTAL support for localization with gettext
+	  which is currently disabled by default in official Git
+	  releases.
+
+	  If you really want to build it you have to specify NO_GETTEXT=
+	  as a Makefile argument. If you're a downstream distributor
+	  please don't do so without consulting with the Git Mailing List
+	  first about the stability of this feature.
+
+	  It's only being included in releases so that source messages can
+	  be marked for translation without resulting in painful and
+	  inevitable merge conflicts between Git's pu branch and the
+	  rest. END WARNING.
+
+	  The primary target is GNU libintl, but the Solaris gettext
 	  implementation also works.
 
 	  We need a gettext.h on the system for C code, gettext.sh (or
diff --git a/Makefile b/Makefile
index 9818a59..bd61a5b 100644
--- a/Makefile
+++ b/Makefile
@@ -272,6 +272,10 @@ ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
 
+# Disable gettext by default in releases while the implementation is
+# settling
+NO_GETTEXT = YesPleaseForNow
+
 # Among the variables below, these:
 #   gitexecdir
 #   template_dir
diff --git a/configure.ac b/configure.ac
index 1821d89..c9b0265 100644
--- a/configure.ac
+++ b/configure.ac
@@ -806,7 +806,7 @@ AC_SUBST(HAVE_PATHS_H)
 #
 # Define NO_GETTEXT if you don't have libintl.h
 AC_CHECK_HEADER([libintl.h],
-[NO_GETTEXT=],
+[NO_GETTEXT=HaveItButYesPlease],
 [NO_GETTEXT=YesPlease])
 AC_SUBST(NO_GETTEXT)
 #
-- 
1.7.2.2.535.g1333f.dirty
Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 42 of 55 in “Begin gettextizing Git”
  1. 00/17 Begin gettextizing GitÆvar Arnfjörð Bjarmason, Aug 30, 2010
  2. 01/17 Makefile: A variable for options used by xgettext(1) callsÆvar Arnfjörð Bjarmason, Aug 30, 2010
  3. Jonathan NiederAug 31, 2010
  4. Ævar Arnfjörð BjarmasonAug 31, 2010
  5. 02/17 Makefile: provide a --msgid-bugs-address to xgettext(1)Ævar Arnfjörð Bjarmason, Aug 30, 2010
  6. 03/17 Makefile: tell xgettext(1) that our source is in UTF-8Ævar Arnfjörð Bjarmason, Aug 30, 2010
  7. 04/17 builtin.h: Include gettext.hÆvar Arnfjörð Bjarmason, Aug 30, 2010
  8. 05/17 gettext: make the simple parts of git-init localizableÆvar Arnfjörð Bjarmason, Aug 30, 2010
  9. Jonathan NiederAug 31, 2010
  10. Ævar Arnfjörð BjarmasonAug 31, 2010
  11. Jonathan NiederAug 31, 2010
  12. Ævar Arnfjörð BjarmasonAug 31, 2010
  13. Jonathan NiederAug 31, 2010
  14. Junio C HamanoAug 31, 2010
  15. 06/17 gettext: localize the main git-init messageÆvar Arnfjörð Bjarmason, Aug 30, 2010
  16. Jonathan NiederAug 31, 2010
  17. Ævar Arnfjörð BjarmasonAug 31, 2010
  18. Jonathan NiederAug 31, 2010
  19. 07/17 gettext.c: work around us not using setlocale(LC_CTYPE, "")Ævar Arnfjörð Bjarmason, Aug 30, 2010
  20. Jonathan NiederAug 31, 2010
  21. Marcin CieslakAug 31, 2010
  22. Jonathan NiederAug 31, 2010
  23. Ævar Arnfjörð BjarmasonAug 31, 2010
  24. Jonathan NiederAug 31, 2010
  25. Erik Faye-LundAug 31, 2010
  26. 08/17 gettext tests: test if $VERSION exists before using itÆvar Arnfjörð Bjarmason, Aug 30, 2010
  27. 09/17 gettext tests: update test/is.po to match t/t0200/test.cÆvar Arnfjörð Bjarmason, Aug 30, 2010
  28. 10/17 gettext tests: add detection for is_IS.ISO-8859-1 localeÆvar Arnfjörð Bjarmason, Aug 30, 2010
  29. 11/17 gettext tests: test message re-encoding under ShellÆvar Arnfjörð Bjarmason, Aug 30, 2010
  30. 12/17 gettext tests: test re-encoding with a UTF-8 msgid under ShellÆvar Arnfjörð Bjarmason, Aug 30, 2010
  31. 13/17 gettext tests: mark a test message as not needing translationÆvar Arnfjörð Bjarmason, Aug 30, 2010
  32. 14/17 po/is.po: msgmerge and add Language: headerÆvar Arnfjörð Bjarmason, Aug 30, 2010
  33. 15/17 po/is.po: add Icelandic translationÆvar Arnfjörð Bjarmason, Aug 30, 2010
  34. Jonathan NiederAug 31, 2010
  35. Ævar Arnfjörð BjarmasonAug 31, 2010
  36. Erik Faye-LundAug 31, 2010
  37. Ævar Arnfjörð BjarmasonAug 31, 2010
  38. Erik Faye-LundAug 31, 2010
  39. 16/17 po/pl.po: add Polish translationÆvar Arnfjörð Bjarmason, Aug 30, 2010
  40. 17/17 gettext tests: test message re-encoding under CÆvar Arnfjörð Bjarmason, Aug 30, 2010
  41. Junio C HamanoAug 30, 2010
  42. gettext: Make NO_GETTEXT=YesPlease the default in releasesÆvar Arnfjörð Bjarmason, Aug 31, 2010
  43. Ævar Arnfjörð BjarmasonAug 31, 2010
  44. Jonathan NiederAug 31, 2010
  45. Ævar Arnfjörð BjarmasonAug 31, 2010
  46. Jonathan NiederAug 31, 2010
  47. Ævar Arnfjörð BjarmasonAug 31, 2010
  48. Jonathan NiederAug 31, 2010
  49. Peter KreftingAug 31, 2010
  50. Ævar Arnfjörð BjarmasonAug 31, 2010
  51. Peter KreftingAug 31, 2010
  52. Matthieu MoyAug 31, 2010
  53. Ævar Arnfjörð BjarmasonAug 31, 2010
  54. Jonathan NiederAug 31, 2010
  55. Ævar Arnfjörð BjarmasonAug 31, 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.