summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bouchaud (yoz) <yoz@efl.so>2019-01-14 11:28:00 +0100
committerMichael Bouchaud (yoz) <yoz@efl.so>2019-01-14 11:29:06 +0100
commit46e8b20a940f2976b10e6feea4d0574e591871c3 (patch)
treed56dcae810c8684c444fc5d244df128c3a3345fc
parentb2a6e57fb482db32e521bd3ce4118e49451d01e0 (diff)
Move gettext infra to module path
-rw-r--r--meson.build12
-rwxr-xr-xpo/locale_install.sh11
-rw-r--r--po/meson.build4
-rw-r--r--src/main.c2
-rw-r--r--src/mod.c10
5 files changed, 31 insertions, 8 deletions
diff --git a/meson.build b/meson.build
index 21fb65e..8bbf078 100644
--- a/meson.build
+++ b/meson.build
@@ -34,12 +34,11 @@ module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release)
34desktop_data = configuration_data() 34desktop_data = configuration_data()
35desktop_data.set('GADGET_VERSION', meson.project_version()) 35desktop_data.set('GADGET_VERSION', meson.project_version())
36dir_prefix = dep_e.get_pkgconfig_variable('prefix') 36dir_prefix = dep_e.get_pkgconfig_variable('prefix')
37
37if get_option('sandbox') 38if get_option('sandbox')
38 dir_lib = join_paths(dir_prefix, get_option('libdir')) 39 dir_lib = join_paths(dir_prefix, get_option('libdir'))
39 dir_gadgets = join_paths([dir_lib, 'enlightenment/gadgets', module_arch, 'weather']) 40 dir_gadgets = join_paths([dir_lib, 'enlightenment/gadgets', module_arch, 'weather'])
40 dir_gadgets_e = join_paths([dir_lib, 'enlightenment/gadgets', module_arch]) 41 dir_gadgets_e = join_paths([dir_lib, 'enlightenment/gadgets', module_arch])
41 config_h.set_quoted('PACKAGE_PREFIX', dir_prefix)
42 desktop_data.set('E_GADGET_DIR', dir_gadgets_e)
43else 42else
44 if get_option('home-install') 43 if get_option('home-install')
45 pymodule = import('python') 44 pymodule = import('python')
@@ -56,16 +55,17 @@ else
56 endif 55 endif
57endif 56endif
58 57
58dir_locales = join_paths([dir_gadgets, 'locale'])
59if get_option('sandbox') 59if get_option('sandbox')
60 config_h.set_quoted('THEMEDIR', dir_gadgets)
61 config_h.set('WEATHER_SANDBOX', '1')
62 config_h.set_quoted('PACKAGE_LOCALE_DIR', dir_locales)
60 if get_option('test') 63 if get_option('test')
61 config_h.set('WEATHER_TEST', '1') 64 config_h.set('WEATHER_TEST', '1')
62 endif 65 endif
63 config_h.set_quoted('THEMEDIR', dir_gadgets) 66 desktop_data.set('E_GADGET_DIR', dir_gadgets_e)
64 config_h.set('WEATHER_SANDBOX', '1')
65endif 67endif
66 68
67
68
69if get_option('sandbox') 69if get_option('sandbox')
70 configure_file(input: 'weather.desktop.in', 70 configure_file(input: 'weather.desktop.in',
71 output: 'weather.desktop', 71 output: 'weather.desktop',
diff --git a/po/locale_install.sh b/po/locale_install.sh
new file mode 100755
index 0000000..eb08286
--- /dev/null
+++ b/po/locale_install.sh
@@ -0,0 +1,11 @@
1#!/bin/sh
2
3project_name=${1}
4locales_dir=${2}
5
6for i in ${MESON_BUILD_ROOT}/po/*.gmo
7do
8 echo "Installing ${i} ${DESTDIR}${locales_dir}/$(basename ${i} .gmo)/LC_MESSAGES/${project_name}.mo"
9 mkdir -p ${DESTDIR}${locales_dir}/$(basename ${i} .gmo)/LC_MESSAGES/
10 install -m 0644 ${i} ${DESTDIR}${locales_dir}/$(basename ${i} .gmo)/LC_MESSAGES/${project_name}.mo
11done
diff --git a/po/meson.build b/po/meson.build
index ed10096..8e9cc6b 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -12,7 +12,9 @@ if get_option('nls')
12 '--keyword=NP_:1,2', 12 '--keyword=NP_:1,2',
13 '--from-code=UTF-8', 13 '--from-code=UTF-8',
14 '--foreign-user' 14 '--foreign-user'
15 ]) 15 ],
16 install: false)
16 config_h.set('HAVE_GETTEXT', '1') 17 config_h.set('HAVE_GETTEXT', '1')
17 dep_intl = cc.find_library('intl', required : false) 18 dep_intl = cc.find_library('intl', required : false)
19 meson.add_install_script('locale_install.sh', meson.project_name(), dir_locales)
18endif 20endif
diff --git a/src/main.c b/src/main.c
index 18e5ced..4447f66 100644
--- a/src/main.c
+++ b/src/main.c
@@ -54,7 +54,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
54 } 54 }
55 setlocale(LC_ALL, ""); 55 setlocale(LC_ALL, "");
56#ifdef HAVE_GETTEXT 56#ifdef HAVE_GETTEXT
57 bindtextdomain(GADGET_NAME, PACKAGE_PREFIX"/share/locale/"); 57 bindtextdomain(GADGET_NAME, PACKAGE_LOCALE_DIR);
58 textdomain(GADGET_NAME); 58 textdomain(GADGET_NAME);
59 bind_textdomain_codeset(GADGET_NAME, "UTF-8"); 59 bind_textdomain_codeset(GADGET_NAME, "UTF-8");
60#endif 60#endif
diff --git a/src/mod.c b/src/mod.c
index c5310c2..4a35ace 100644
--- a/src/mod.c
+++ b/src/mod.c
@@ -12,7 +12,17 @@ E_API E_Module_Api e_modapi =
12E_API void * 12E_API void *
13e_modapi_init(E_Module *m) 13e_modapi_init(E_Module *m)
14{ 14{
15 char buf[PATH_MAX];
16
15 if (!E_EFL_VERSION_MINIMUM(1, 17, 99)) return NULL; 17 if (!E_EFL_VERSION_MINIMUM(1, 17, 99)) return NULL;
18
19#ifdef HAVE_GETTEXT
20 /* Location of message catalogs for localization */
21 snprintf(buf, sizeof(buf), "%s/locale", e_module_dir_get(m));
22 bindtextdomain(GADGET_NAME, buf);
23 bind_textdomain_codeset(GADGET_NAME, "UTF-8");
24#endif
25
16 config_init(); 26 config_init();
17 weather_init(); 27 weather_init();
18 weather_plugin_init(); 28 weather_plugin_init();