build: Create available translations in Meson

This commit is contained in:
Peter Eisenmann
2025-01-21 01:59:31 +00:00
parent 7ecdab8598
commit 867e2aa9e0
3 changed files with 11 additions and 4 deletions

View File

@@ -1,3 +1,12 @@
translations = []
po_files = run_command('ls', check: true).stdout().strip()
foreach po_file : po_files.split('\n')
if po_file.endswith('.po')
translations += po_file.substring(0, -3)
endif
endforeach
# create Python list
available_translations = '["' + '", "'.join(translations) + '"]'
i18n.gettext('os-installer', preset: 'glib', args: '--add-location=file')

View File

@@ -8,7 +8,7 @@ conf.set('PYTHON', python.find_installation('python3').full_path())
conf.set('VERSION', meson.project_version())
conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir')))
conf.set('pkgdatadir', pkgdatadir)
conf.set('po_files', po_files)
conf.set('available_translations', available_translations)
configure_file(
input: 'os-installer.in',

View File

@@ -5,9 +5,7 @@ import signal
import sys
localedir = '@localedir@'
# TODO: Flatten this string in meson?
po_files='''@po_files@'''.split('\n')
available_translations = [po[:-3] for po in po_files if po.endswith('.po')]
available_translations = @available_translations@
config_localedir="/etc/os-installer/po/"
pkgdatadir = '@pkgdatadir@'
VERSION = '@VERSION@'