[virt-tools-list] [virt-viewer PATCH 01/14] po: provide custom make rules for po file management

Christophe Fergeau cfergeau at redhat.com
Mon Mar 11 11:05:25 UTC 2019


Hey,

On Thu, Mar 07, 2019 at 02:42:45PM +0000, Daniel P. Berrangé wrote:
> After investigating in more detail it seems you can provide custom rules
> for XML files by setting GETTEXTDATADIR, so I can support mime files with
> this extra diff:

Ah indeed, nice finding. Seeing what is shipped in
https://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/its
(gsettings, glade, ... rules), this mime rule could probably go there as
well.

> 
> diff --git a/data/Makefile.am b/data/Makefile.am
> index 0e50f3d..d4089be 100644
> --- a/data/Makefile.am
> +++ b/data/Makefile.am
> @@ -4,6 +4,8 @@ MANUFACTURER = Virt Manager Project
>  
>  EXTRA_DIST =                                   \
>         virt-viewer.wxs.in                      \
> +       gettext/its/mime.its                    \
> +       gettext/its/mime.loc                    \
>         $(NULL)
>  
>  # this make sure those files are regenerated when they change
> @@ -71,8 +73,11 @@ desktop_DATA     = $(DESKTOPFILES:.desktop.in=.desktop)
>  %.desktop: %.desktop.in
>         $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
>  
> +MIMEFILES = virt-viewer-mime.xml.in
>  mimedir = $(datadir)/mime/packages
>  mime_DATA = virt-viewer-mime.xml
> +%-mime.xml: %-mime.xml.in
> +       $(AM_V_GEN)GETTEXTDATADIR=$(srcdir)/gettext $(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@

Something I just noticed (but which is related to the initial patch
rather than this one) is that the .xml.in -> .xml rule is no longer
triggered when one of the .po file changes (same for the .desktop file).
I tried adding $(wildcard $(top_srcdir)/po/*.po) as a dependency, and as
far as I can tell, this is giving the behaviour I want. 

A similar change is needed in po/Makefile.am in the call to xgettext,
and virt-viewer-mime.xml.in needs to be listed in POTFILES, with these
changes I can now translate the mime file!

Thanks,

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20190311/e73c99b1/attachment.sig>


More information about the virt-tools-list mailing list