Skip to content

Commit 62ec69b

Browse files
Fix desktop and metainfo files translation.
1 parent f989b90 commit 62ec69b

File tree

6 files changed

+34
-17
lines changed

6 files changed

+34
-17
lines changed

data/meson.build

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,29 @@ gorfector_resources = gnome.compile_resources(
1010
c_name: 'gorfector_resources',
1111
)
1212

13+
msgfmt = find_program('msgfmt')
14+
1315
desktop_conf = configuration_data()
1416
desktop_conf.set('icon', app_id)
1517
desktop_conf.set('version', meson.project_version())
16-
desktop_file = i18n.merge_file(
17-
type: 'desktop',
18+
desktop_file = custom_target(
19+
'desktop_file',
1820
input: configure_file(
1921
input: 'com.patrickfournier.gorfector.desktop.in.in',
2022
output: '@BASENAME@',
2123
configuration: desktop_conf
2224
),
2325
output: '@0@.desktop'.format(app_id),
24-
po_dir: podir,
26+
command: [
27+
msgfmt,
28+
'--desktop',
29+
'-d', 'po',
30+
'--template=@INPUT@',
31+
'--output-file=@OUTPUT@',
32+
],
2533
install: true,
26-
install_dir: join_paths(datadir, 'applications')
34+
install_dir: join_paths(datadir, 'applications'),
35+
depends: update_all_po,
2736
)
2837

2938
subdir('metainfo')

data/metainfo/meson.build

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
metainfo_conf = configuration_data()
22
metainfo_conf.set('APP_ID', app_id)
33

4-
metainfo_file = 'com.patrickfournier.gorfector.metainfo.xml.in.in'
5-
metainfo_file = i18n.merge_file(
4+
metainfo_file = custom_target(
5+
'metainfo_file',
66
input: configure_file(
77
input: 'com.patrickfournier.gorfector.metainfo.xml.in.in',
8-
output: 'com.patrickfournier.gorfector.metainfo.xml.in',
9-
configuration: metainfo_conf,
8+
output: '@BASENAME@',
9+
configuration: metainfo_conf
1010
),
1111
output: app_id + '.metainfo.xml',
12-
type: 'xml',
13-
po_dir: podir,
12+
command: [
13+
msgfmt,
14+
'--xml',
15+
'-d', 'po',
16+
'--template=@INPUT@',
17+
'--output-file=@OUTPUT@',
18+
],
1419
install: true,
15-
install_dir: join_paths (get_option ('datadir'), 'metainfo')
20+
install_dir: join_paths (get_option ('datadir'), 'metainfo'),
21+
depends: update_all_po,
1622
)
1723

1824
# Validate MetaInfo file

meson.build

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ project('gorfector',
1111
)
1212

1313
gnome = import('gnome')
14-
i18n = import('i18n')
1514

1615
cx = meson.get_compiler('cpp')
1716

@@ -22,7 +21,6 @@ else
2221
endif
2322

2423
gettext_package = meson.project_name()
25-
podir = join_paths(meson.project_source_root(), 'po')
2624

2725
datadir = join_paths(get_option('prefix'), get_option('datadir'))
2826

@@ -56,9 +54,9 @@ cxxflags = [
5654
]
5755

5856
subdir('scanners')
59-
subdir('data')
6057
subdir('help')
6158
subdir('po')
59+
subdir('data')
6260
subdir('src')
6361

6462
gnome.post_install(

po/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ update_pot = custom_target(
146146
update_all_po = custom_target(
147147
'update_all_po',
148148
input: update_pot,
149-
output: po_files,
149+
output: ['LINGUAS', po_files],
150150
command: [
151151
'meson_helpers/update_all_po.sh',
152152
'@CURRENT_SOURCE_DIR@',

po/meson_helpers/compile_all_mo.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
out_dir=$1
44
package_name=$2
5-
shift 2
5+
# linguas_file=$3
6+
shift 3
67

78
echo "Info: Compiling .po files to .mo files"
89

po/meson_helpers/update_all_po.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ build_dir=$2
55
pot_file=$3
66

77
shift 3
8+
langs=$*
89

9-
for lang in "$@"; do
10+
for lang in ${langs}; do
1011
if [[ -f "${build_dir}/${lang}.po" ]]; then
1112
rm "${build_dir}/${lang}.po"
1213
fi
@@ -20,3 +21,5 @@ for lang in "$@"; do
2021
mv "${build_dir}/${lang}.po" "${src_dir}/${lang}.po"
2122
ln -rs "${src_dir}/${lang}.po" "${build_dir}/${lang}.po"
2223
done
24+
25+
printf "%s\n" $langs > "${build_dir}/LINGUAS"

0 commit comments

Comments
 (0)