[gimp] po-windows-installer: fix double escaped ampersand in XML for the…



commit 7375116d46faede26eea38ac2b7ee29513f415e6
Author: Jehan <jehan girinstud io>
Date:   Mon Aug 22 20:32:30 2022 +0200

    po-windows-installer: fix double escaped ampersand in XML for the…
    
    … Windows installer localization.
    
    There are kind of 2 separate bugs here:
    
    - Direct i18n.gettext() to the proper data directory where to find the
      ITS file. Otherwise `meson compile gimp30-windows-installer-pot` and
      `meson compile gimp30-windows-installer-update-po` complained about
      not knowing XML and falling back to C, which is obviously a problem:
    
    > /usr/bin/xgettext: warning: file 'build/windows/installer/lang/setup.isl.xml.in' extension 'xml' is 
unknown; will try C
    
    - Set gt:escapeRule to "no" in the ITS file, otherwise the XML entity is
      kept as-is in the po file (i.e. "&amp;" stays "&amp;" inside the po
      files), but it's considered as raw text when merged back to XML, i.e.
      that the '&' is properly converted to a XML entity, so we end up with
      a double escape "&amp;amp;".
      Now the po file will have a '&' which will still be converted to XML
      entity at merge time. This is actually most likely better than asking
      translators to handle XML entities themselves (with the possibility to
      make typos and break the XML entity).
    
    See https://savannah.gnu.org/bugs/?58643

 build/windows/installer/lang/its/gimp-ms-installer-config.its | 1 +
 po-windows-installer/meson.build                              | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/build/windows/installer/lang/its/gimp-ms-installer-config.its 
b/build/windows/installer/lang/its/gimp-ms-installer-config.its
index ffd15e76f5..4d343ad9b6 100644
--- a/build/windows/installer/lang/its/gimp-ms-installer-config.its
+++ b/build/windows/installer/lang/its/gimp-ms-installer-config.its
@@ -3,4 +3,5 @@
            xmlns:gt="https://www.gnu.org/s/gettext/ns/its/extensions/1.0";>
   <its:translateRule selector="/gimp-ms-installer-config" translate="no"/>
   <its:translateRule selector="//value" translate="yes"/>
+  <gt:escapeRule selector="//value" escape="no"/>
 </its:rules>
diff --git a/po-windows-installer/meson.build b/po-windows-installer/meson.build
index abcb8ed049..1a88b0c03a 100644
--- a/po-windows-installer/meson.build
+++ b/po-windows-installer/meson.build
@@ -1,2 +1,3 @@
 po_windows_installer_dir = meson.current_source_dir()
-i18n.gettext(gettext_package + '-windows-installer', preset: 'glib', install: false)
+i18n.gettext(gettext_package + '-windows-installer', preset: 'glib', install: false,
+             data_dirs: meson.source_root() / 'build' / 'windows' / 'installer' / 'lang')


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