Skip to content

Commit 31efb0e

Browse files
authored
Merge pull request #196 from louis77/development
Translation integration
2 parents 8f10fdf + cdb95bd commit 31efb0e

File tree

2 files changed

+35
-24
lines changed

2 files changed

+35
-24
lines changed

meson_options.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
option('translation',
2+
type: 'combo',
3+
choices: ['update','none'],
4+
value: 'none',
5+
description: 'Translation build mode'
6+
)

po/meson.build

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,36 @@
55
message('Installing translations...')
66

77
# Generate POT file if not a snapshot build
8+
if get_option('translation') == 'update'
9+
pot = custom_target('pot',
10+
input: 'POTFILES',
11+
output: meson.project_name() + '.pot',
12+
command: [
13+
'xgettext',
14+
'--files-from=@INPUT@',
15+
'--output=' + meson.current_source_dir() + '/' + meson.project_name() + '.pot',
16+
'--from-code=UTF-8',
17+
'--package-name=' + meson.project_name(),
18+
'--package-version=' + meson.project_version(),
19+
'--keyword=_',
20+
'--keyword=N_',
21+
'--keyword=C_:1c,2',
22+
'--keyword=NC_:1c,2',
23+
'--add-comments=TRANSLATORS',
24+
'--sort-output',
25+
'--width=80',
26+
'--foreign-user',
27+
'--directory=' + meson.project_source_root(),
28+
]
29+
)
30+
31+
# Make POT a build dependency for translations in debug mode
32+
translations = [pot]
33+
else
34+
translations = []
35+
endif
836

9-
pot = custom_target('pot',
10-
input: 'POTFILES',
11-
output: meson.project_name() + '.pot',
12-
command: [
13-
'xgettext',
14-
'--files-from=@INPUT@',
15-
'--output=' + meson.current_source_dir() + '/' + meson.project_name() + '.pot', # Output to source dir
16-
'--from-code=UTF-8',
17-
'--package-name=' + meson.project_name(),
18-
'--package-version=' + meson.project_version(),
19-
'--keyword=_',
20-
'--keyword=N_',
21-
'--keyword=C_:1c,2',
22-
'--keyword=NC_:1c,2',
23-
'--add-comments=TRANSLATORS',
24-
'--sort-output',
25-
'--width=80',
26-
'--foreign-user',
27-
'--directory=' + meson.project_source_root(),
28-
]
29-
)
30-
31-
# Install translations - process each .po file
32-
translations = []
37+
# Process .po files
3338
foreach lang : run_command('cat', 'LINGUAS', check: true).stdout().strip().split('\n')
3439
po_file = lang + '.po'
3540
if run_command('test', '-f', po_file, check: false).returncode() == 0

0 commit comments

Comments
 (0)