Hello, Guy Rutenberg <guyrutenb...@gmail.com> 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