[bijiben/wip/inigomartinez/meson: 4/4] build: Migrated from Intltool to Gettext



commit 73dbeb51147e555ccb182f5735ef7d87783cd9c8
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Aug 18 13:02:01 2017 +0200

    build: Migrated from Intltool to Gettext
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786461

 data/meson.build                      |   14 ++++++++------
 data/org.gnome.bijiben.appdata.xml.in |   10 +++++-----
 data/org.gnome.bijiben.desktop.in.in  |    9 ++++-----
 data/org.gnome.bijiben.xml.in         |    2 +-
 gettext/its/mime.its                  |    6 ++++++
 gettext/its/mime.loc                  |    6 ++++++
 meson.build                           |    6 +-----
 po/POTFILES.in                        |    8 ++++----
 po/meson.build                        |    6 +++++-
 9 files changed, 40 insertions(+), 27 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index a97ba8d..d5fca65 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -2,22 +2,23 @@ subdir('icons')
 
 mime = 'org.gnome.bijiben.xml'
 
-custom_target(
+i18n.merge_file(
   mime,
   input: mime + '.in',
   output: mime,
-  command: intltool_xml_cmd,
+  po_dir: po_dir,
+  data_dirs: its_dir,
   install: true,
   install_dir: join_paths(bijiben_datadir, 'mime', 'packages')
 )
 
 info = 'org.gnome.bijiben.metainfo.xml'
 
-custom_target(
+i18n.merge_file(
   info,
   input: 'org.gnome.bijiben.appdata.xml.in',
   output: info,
-  command: intltool_xml_cmd,
+  po_dir: po_dir,
   install: true,
   install_dir: join_paths(bijiben_datadir, 'metainfo')
 )
@@ -33,11 +34,12 @@ desktop_in = configure_file(
   configuration: desktop_conf
 )
 
-custom_target(
+i18n.merge_file(
   desktop,
+  type: 'desktop',
   input: desktop_in,
   output: desktop,
-  command: intltool_desktop_cmd,
+  po_dir: po_dir,
   install: true,
   install_dir: join_paths(bijiben_datadir, 'applications')
 )
diff --git a/data/org.gnome.bijiben.appdata.xml.in b/data/org.gnome.bijiben.appdata.xml.in
index 0ef0921..76638e7 100644
--- a/data/org.gnome.bijiben.appdata.xml.in
+++ b/data/org.gnome.bijiben.appdata.xml.in
@@ -4,14 +4,14 @@
   <metadata_license>CC0-1.0</metadata_license>
   <project_license>GPL-3.0+ and LGPL-3.0 and LGPL-2.0+</project_license>
   <name>Bijiben</name>
-  <_summary>Quickly jot notes</_summary>
+  <summary>Quickly jot notes</summary>
   <description>
-    <_p>
+    <p>
       Notes is an editor allowing to make simple lists for later use.
-    </_p>
-    <_p>
+    </p>
+    <p>
       It allows to use ownCloud as a storage location and online editor.
-    </_p>
+    </p>
   </description>
   <kudos>
     <kudo>AppMenu</kudo>
diff --git a/data/org.gnome.bijiben.desktop.in.in b/data/org.gnome.bijiben.desktop.in.in
index 7f5009d..af06fa0 100644
--- a/data/org.gnome.bijiben.desktop.in.in
+++ b/data/org.gnome.bijiben.desktop.in.in
@@ -1,9 +1,8 @@
-
 [Desktop Entry]
-_Name=Notes
-_Keywords=notes;reminder;
-_Comment=Post notes, tag files!
-_GenericName=Note-taker
+Name=Notes
+Keywords=notes;reminder;
+Comment=Post notes, tag files!
+GenericName=Note-taker
 Exec=bijiben %u
 Icon=org.gnome.bijiben
 MimeType=x-scheme-handler/note;
diff --git a/data/org.gnome.bijiben.xml.in b/data/org.gnome.bijiben.xml.in
index 56636a9..f511fd9 100644
--- a/data/org.gnome.bijiben.xml.in
+++ b/data/org.gnome.bijiben.xml.in
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='utf-8'?>
 <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
     <mime-type type="application/x-note">
-        <_comment>Notes</_comment>
+        <comment>Notes</comment>
         <glob pattern="*.note"/>
     </mime-type>
 </mime-info>
diff --git a/gettext/its/mime.its b/gettext/its/mime.its
new file mode 100644
index 0000000..dec8d13
--- /dev/null
+++ b/gettext/its/mime.its
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<its:rules xmlns:its="http://www.w3.org/2005/11/its";
+           version="2.0">
+  <its:translateRule selector="/mime-info" translate="no"/>
+  <its:translateRule selector="//comment" translate="yes"/>
+</its:rules>
diff --git a/gettext/its/mime.loc b/gettext/its/mime.loc
new file mode 100644
index 0000000..a34fe8d
--- /dev/null
+++ b/gettext/its/mime.loc
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<locatingRules>
+  <locatingRule name="mime" pattern="*.xml">
+    <documentRule localName="mime-info" target="mime.its"/>
+  </locatingRule>
+</locatingRules>
diff --git a/meson.build b/meson.build
index 53c68d2..a18d29d 100644
--- a/meson.build
+++ b/meson.build
@@ -156,11 +156,7 @@ gnome = import('gnome')
 i18n = import('i18n')
 
 po_dir = join_paths(meson.source_root(), 'po')
-
-intltool_merge = find_program('intltool-merge')
-intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
-intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
-intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+its_dir = join_paths(meson.source_root(), 'gettext')
 
 top_inc = include_directories('.')
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index f00fbc3..86821f7 100755
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,7 @@
 # List of source files containing translatable strings.
 data/org.gnome.bijiben.appdata.xml.in
 data/org.gnome.bijiben.desktop.in.in
-[type: gettext/gsettings]data/org.gnome.bijiben.gschema.xml
+data/org.gnome.bijiben.gschema.xml
 data/org.gnome.bijiben.xml.in
 src/bijiben-shell-search-provider.c
 src/bjb-app-menu.c
@@ -23,6 +23,6 @@ src/bjb-window-base.c
 src/libbiji/biji-date-time.c
 src/libbiji/biji-notebook.c
 src/libbiji/provider/biji-local-provider.c
-[type: gettext/glade]src/resources/app-menu.ui
-[type: gettext/glade]src/resources/editor-toolbar.ui
-[type: gettext/glade]src/resources/settings-dialog.ui
+src/resources/app-menu.ui
+src/resources/editor-toolbar.ui
+src/resources/settings-dialog.ui
diff --git a/po/meson.build b/po/meson.build
index e9b77d7..9440ab9 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1,5 @@
-i18n.gettext(meson.project_name(), preset: 'glib')
+i18n.gettext(
+  meson.project_name(),
+  data_dirs: its_dir,
+  preset: 'glib'
+)


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