build: Create available translations in Meson
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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@'
|
||||
|
||||
Reference in New Issue
Block a user