|
5 | 5 | message('Installing translations...') |
6 | 6 |
|
7 | 7 | # 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 |
8 | 36 |
|
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 |
33 | 38 | foreach lang : run_command('cat', 'LINGUAS', check: true).stdout().strip().split('\n') |
34 | 39 | po_file = lang + '.po' |
35 | 40 | if run_command('test', '-f', po_file, check: false).returncode() == 0 |
|
0 commit comments