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

Christophe Fergeau cfergeau at redhat.com
Tue Mar 5 10:23:34 UTC 2019


On Wed, Feb 20, 2019 at 05:50:52PM +0000, Daniel P. Berrangé wrote:
> Historically we have relied on intltool to install a standard
> po/Makefile.in.in which has very limited scope for customization.
> intltool is deprecated in favour of standard gettextize tools,
> but these share the same disadvantages.
> 
> Writing make rules for po file management is no more difficult
> than any other rules libvirt-glib has, so stop using intltool

s/libvirt-glib/virt-viewer

> and don't use gettextize ether.

> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>

> diff --git a/data/Makefile.am b/data/Makefile.am
> index 1f6c8bf..0e50f3d 100644
> --- a/data/Makefile.am
> +++ b/data/Makefile.am
> @@ -68,17 +68,17 @@ else #!WIN32
>  desktopdir       = $(datadir)/applications
>  DESKTOPFILES     = remote-viewer.desktop.in
>  desktop_DATA     = $(DESKTOPFILES:.desktop.in=.desktop)
> - at INTLTOOL_DESKTOP_RULE@
> +%.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
> - at INTLTOOL_XML_RULE@

Why drop translations from the mime file?


> diff --git a/data/remote-viewer.appdata.xml.in b/data/remote-viewer.appdata.xml.in
> index 3f6017d..53945f4 100644
> --- a/data/remote-viewer.appdata.xml.in
> +++ b/data/remote-viewer.appdata.xml.in
> @@ -1,19 +1,19 @@
>  <?xml version="1.0" encoding="UTF-8"?>
> -<application>
> +<component type="desktop">

I assume this change is needed in order for gettext to recognize this
xml file as translatable?

>   <id type="desktop">remote-viewer.desktop</id>
>   <metadata_license>CC0-1.0</metadata_license>
>   <project_license>GPL-2.0+</project_license>
> - <_name>Remote Viewer</_name>
> - <_summary>Remotely access virtual machines</_summary>
> + <name>Remote Viewer</name>
> + <summary>Remotely access virtual machines</summary>
>   <description>
> -  <_p>
> +  <p>
>      Remote Viewer provides a graphical viewer for the guest OS
>      display. At this time it supports guest OS using the VNC
>      or SPICE protocols. Further protocols may be supported in
>      the future as user demand dictates. The viewer can connect
>      directly to both local and remotely hosted guest OS, optionally
>      using SSL/TLS encryption.
> -  </_p>
> +  </p>
>   </description>
>   <screenshots>
>    <screenshot type="default">https://virt-manager.org/appdata/en_US/virt-viewer/general.png</screenshot>

> diff --git a/po/Makefile.am b/po/Makefile.am
> new file mode 100644
> index 0000000..c5f7c36
> --- /dev/null
> +++ b/po/Makefile.am
> @@ -0,0 +1,105 @@
> +DOMAIN = $(PACKAGE_NAME)
> +COPYRIGHT_HOLDER = The Libvirt authors
> +MSGID_BUGS_ADDRESS = https://libvirt.org/bugs.html

This needs to be updated

> +
> +MAINTAINERCLEANFILES = $(GMOFILES) $(POTFILE)
> +
> +LANGS := \
> +	af am anp ar as ast bal be bg \
> +	bn_IN bn bo br brx bs ca cs cy da \
> +	de_CH de el en_GB eo es et eu fa fi \
> +	fr gl gu he hi hr hu ia \
> +	id ilo is it ja ka kk km kn ko \
> +	kw_GB kw at kkcor kw kw at uccor ky lt lv mai mk ml \
> +	mn mr ms nb nds ne nl nn nso \
> +	or pa pl pt_BR pt ro ru si sk sl \
> +	sq sr at latin sr sv ta te tg th tr tw \
> +	uk ur vi wba yo zh_CN zh_HK zh_TW zu
> +
> +
> +POTFILE_DEPS := $(shell $(SED) 's,^,$(top_srcdir)/,' $(srcdir)/POTFILES)
> +POTFILE := $(srcdir)/$(DOMAIN).pot
> +POFILES := $(LANGS:%=$(srcdir)/%.po)
> +GMOFILES := $(LANGS:%=$(srcdir)/%.gmo)
> +
> +EXTRA_DIST = \
> +	POTFILES \
> +	$(POTFILE) \
> +	$(POFILES) \
> +	$(GMOFILES)
> +
> +if HAVE_GNU_GETTEXT_TOOLS
> +
> +XGETTEXT_ARGS = \
> +	--default-domain=$(DOMAIN) \
> +	--from-code=utf-8 \
> +	--add-comments=TRANSLATORS: \
> +	 --keyword=_ --keyword=N_ \
> +	--copyright-holder='$(COPYRIGHT_HOLDER)' \
> +	--package-name="$(PACKAGE_NAME)" \
> +	--package-version="$(PACKAGE_VERSION)" \
> +	--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
> +	--directory=$(top_srcdir) \
> +	$(NULL)
> +
> +SED_PO_FIXUP_ARGS = \
> +	-e "s|text/plain; charset=CHARSET|text/plain; charset=UTF-8|g" \
> +	-e "s|SOME DESCRIPTIVE TITLE|Libvirt package strings|g" \

This string needs to be updated too

> +	-e "s|Copyright (C) YEAR|Copyright (C) $$(date +'%Y')|" \
> +	$(NULL)
> +
> diff --git a/po/lt.po b/po/lt.po
> index 9a18f31..90cdc7b 100644
> --- a/po/lt.po
> +++ b/po/lt.po
> @@ -16,7 +16,7 @@ msgstr ""
>  "Content-Type: text/plain; charset=UTF-8\n"
>  "Content-Transfer-Encoding: 8bit\n"
>  "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n"
> -"%100<10 or n%100>=20) ? 1 : 2)\n"
> +"%100<10 || n%100>=20) ? 1 : 2)\n"
>  "X-Generator: Zanata 3.8.4\n"
>  
>  #: ../data/remote-viewer.appdata.xml.in.h:1

Probably not needed here?

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/20190305/f700abcc/attachment.sig>


More information about the virt-tools-list mailing list