[rhythmbox/playlists-its-rule] build: add ITS rule for playlists.xml and use gettext




commit 84cb7745659d0ce39aa37082d05d1b7cd5d10205
Author: Jonathan Matthew <jonathan d14n org>
Date:   Thu Nov 18 08:51:31 2021 +1000

    build: add ITS rule for playlists.xml and use gettext

 data/its/playlists.its |  7 +++++++
 data/its/playlists.loc |  6 ++++++
 data/meson.build       | 10 ++++------
 data/playlists.xml.in  |  6 +++---
 po/meson.build         |  3 ++-
 5 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/data/its/playlists.its b/data/its/playlists.its
new file mode 100644
index 000000000..e76cf2057
--- /dev/null
+++ b/data/its/playlists.its
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<its:rules xmlns:its="http://www.w3.org/2005/11/its";
+           xmlns:gt="https://www.gnu.org/s/gettext/ns/its/extensions/1.0";
+           version="2.0">
+       <its:translateRule selector="/rhythmdb-playlists" translate="no"/>
+       <its:translateRule selector="/rhythmdb-playlists/playlist/name" translate="yes"/>
+</its:rules>
diff --git a/data/its/playlists.loc b/data/its/playlists.loc
new file mode 100644
index 000000000..800757513
--- /dev/null
+++ b/data/its/playlists.loc
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<locatingRules>
+       <locatingRule name="RhythmDBPlaylists" pattern="playlists.xml*">
+               <documentRule localName="rhythmdb-playlists" target="playlists.its"/>
+       </locatingRule>
+</locatingRules>
diff --git a/data/meson.build b/data/meson.build
index 1f5d2f36f..b239eba7b 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -43,14 +43,12 @@ gschemas_compiled = custom_target('gschemas.compiled',
   command: [glib_compile_schemas, '--targetdir=' + meson.current_build_dir(), meson.current_source_dir()]
 )
 
-# It would be nice to avoid requiring intltool, and just use Gettext's msgfmt
-# tool. The blocker is we need to write an appropriate .its file to describe
-# how to translate Rhythmbox's XML playlist format, because msgfmt doesn't
-# support the Intltool 'generic XML style' that we currently use.
-playlists_xml = custom_target('playlists.xml',
+playlists_xml = i18n.merge_file(
+  'playlists.xml',
   input: 'playlists.xml.in',
   output: 'playlists.xml',
-  command: [intltool_merge, '--quiet', '--xml-style', '--utf8', '../po', '@INPUT@', '@OUTPUT@'],
+  po_dir: po_dir,
+  data_dirs: meson.project_source_root() / 'data'
 )
 
 install_data('rhythmbox.gep',
diff --git a/data/playlists.xml.in b/data/playlists.xml.in
index 5ad9ece6f..d30c55ea4 100644
--- a/data/playlists.xml.in
+++ b/data/playlists.xml.in
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>
 <rhythmdb-playlists>
   <playlist type="automatic" limit-count="0" limit-size="0" limit-time="0" sort-key="FirstSeen" 
sort-direction="1">
-    <_name>Recently Added</_name>
+    <name>Recently Added</name>
     <conjunction>
       <equals prop="type">song</equals>
       <subquery>
@@ -12,7 +12,7 @@
     </conjunction>
   </playlist>
   <playlist type="automatic" limit-count="0" limit-size="0" limit-time="0" sort-key="LastPlayed" 
sort-direction="1">
-    <_name>Recently Played</_name>
+    <name>Recently Played</name>
     <conjunction>
       <equals prop="type">song</equals>
       <subquery>
@@ -23,7 +23,7 @@
     </conjunction>
   </playlist>
   <playlist type="automatic" limit-count="0" limit-size="0" limit-time="0" sort-key="Rating" 
sort-direction="1">
-    <_name>My Top Rated</_name>
+    <name>My Top Rated</name>
     <conjunction>
       <equals prop="type">song</equals>
       <subquery>
diff --git a/po/meson.build b/po/meson.build
index 666376680..f8ff9aabf 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,3 +1,4 @@
 i18n.gettext(meson.project_name(),
   preset: 'glib',
-  args: ['--keyword=Description', '--keyword=X-GNOME-FullName'])
+  args: ['--keyword=Description', '--keyword=X-GNOME-FullName'],
+  data_dirs: meson.project_source_root() / 'data')


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