bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] Is it possible to load local catalogs using `gettext`?


From: Daiki Ueno
Subject: Re: [bug-gettext] Is it possible to load local catalogs using `gettext`?
Date: Sat, 18 Oct 2014 11:43:46 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Hello,

Guy Rutenberg <address@hidden> writes:

> Gettext searches for catalogs in a specific hierarchy: 
> LOCALEDIR/ll/LC_MESSAGES
> /PACKAGE.mo . This doesn't suit the usual hierarchy most projects when
> developing, as most have a `po/` directory with `ll.po` files matching each
> language. When running make, those po files turn into `po/ll.gmo`, which does
> not look at all like the hierarchy gettext is looking for.
>
> There are two solutions I see for it and none are satisfactory:
> 1. Modify makefiles to re-create the required hierarchy without `make 
> install`.
> This is usually not possible as people use automake and do not edit makefiles
> manually.
>
> 2. Run `make install` after each time a translation is updated (possibly
> passing --prefix=/somepath/ to ./configure). This works, but it is annoying as
> it complicates the develop-translate-test cycle needlessly.
>
> Is there a good way to workaround it so it is possbile to check changes to
> translation without `make install`?

Sounds a reasonable use-case and I agree that there should be an easy
way to do that.  As a workaround, I'd do the following (not tested):

1. in tests/Makefile.am, extend the 'all' or 'check' rule with something like:

  TEST_LOCALEDIR = $(builddir)/locale

  all-local: 
        cd $(top_builddir)/po && make install localedir=\"$(TEST_LOCALEDIR)\"

  clean-local:
        -rm -rf $(TEST_LOCALEDIR)

2. set TEST_LOCALEDIR envvar through TEST_ENVIRONMENT:

  TEST_ENVIRONMENT=TESTLOCALEDIR=\"$(TEST_LOCALEDIR)\"

3. in the test program, call bindtextdomain with:

  const char *localedir = LOCALEDIR, *envvar;

  envvar = getenv ("TEST_LOCALEDIR");
  if (envvar != NULL && *envvar != '\0')
    localedir = envvar;

  bindtextdomain ("program", localedir);

Regards,
-- 
Daiki Ueno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]