[glib: 1/2] Meson: Add 'nls' option to disable translation



commit 7412011716d9a21ee05516f5c52098dd82ac0893
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Tue Nov 20 11:28:56 2018 -0500

    Meson: Add 'nls' option to disable translation
    
    It is not always needed to generate and install gmo files, for example
    when building for Android or Windows that often doesn't have libintl to
    use them anyway.
    
    At least all GStreamer modules have this same option.

 meson.build       | 10 +++++-----
 meson_options.txt |  6 ++++++
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index ce71ca053..2b310b6ed 100644
--- a/meson.build
+++ b/meson.build
@@ -1796,8 +1796,6 @@ glib_conf.set('HAVE_DCGETTEXT', 1)
 glib_conf.set('HAVE_GETTEXT', 1)
 
 glib_conf.set_quoted('GLIB_LOCALE_DIR', join_paths(glib_datadir, 'locale'))
-# xgettext is optional (on Windows for instance)
-xgettext = find_program('xgettext', required : false)
 
 # libmount is only used by gio, but we need to fetch the libs to generate the
 # pkg-config file below
@@ -1981,12 +1979,14 @@ subdir('gobject')
 subdir('gthread')
 subdir('gmodule')
 subdir('gio')
-if xgettext.found()
-  subdir('po')
-endif
 subdir('fuzzing')
 subdir('tests')
 
+# xgettext is optional (on Windows for instance)
+if find_program('xgettext', required : get_option('nls')).found()
+  subdir('po')
+endif
+
 # Install glib-gettextize executable, if a UNIX-style shell is found
 if have_sh
   # These should not contain " quotes around the values
diff --git a/meson_options.txt b/meson_options.txt
index 64accf68b..d64221eb4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -83,3 +83,9 @@ option('installed_tests',
        type : 'boolean',
        value : false,
        description : 'enable installed tests')
+
+option('nls',
+       type : 'feature',
+       value : 'auto',
+       yield: true,
+       description : 'Enable native language support (translations)')


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