tags:

views:

49

answers:

0

I am migrating a project from autotools to cmake. I have a question about gettext support.

There is an existing FindGettext.cmake modules that provides a nice function :

GETTEXT_CREATE_TRANSLATIONS(foo.pot ALL fr.po de.po)

where you provide a pot file and translated po fil ; the function takes care of turning the po files into gmo files, and add the proper installation targets to make sure the files can be found at runtime. All good and well.

Now comes the question : how do you update your pot files and you po files when you add new messages ?

For this, autotools would generate a "update-po" target, that (from what I understand), reads a POTFILES.in with the lists of all files containing translated strings, mixes it with other info, and ends up calling xgetext to generate the po. I think the coresponding Makefile task is the one that contains something like :

case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
  '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
   --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS)  \
   --files-from=$(srcdir)/POTFILES.in \
   --copyright-holder='$(COPYRIGHT_HOLDER)' \
   --msgid-bugs-address="$$msgid_bugs_address" \
 ;; \
*) \
 $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
   --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS)  \
   --files-from=$(srcdir)/POTFILES.in \
   --copyright-holder='$(COPYRIGHT_HOLDER)' \
   --package-name="$${package_gnu}ube" \
   --package-version='0.4.0-dev' \
   --msgid-bugs-address="$$msgid_bugs_address" \
 ;; \
 esac

So, before I reinvent the wheel, is there an existing cmake function to do the same thing ? Or do I have to find the xgettext executable, lists the files, and do this by hand ? THe makefile version seems quite complicated (although it seems to handle lots of cases) ; I would not mind not having to write the cmake equivalent ;)

Thanks

PH