mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-10 07:20:02 +00:00
35ad5e85dd
Since all messages marked for translation contain permutable format strings, we can add checks for enforcing them. The syntax check does not catch all cases as it only checks format strings between _(" and the first ". In other words messages where \" appears before the first format string or multi-line messages where the first format strings is not in the first line will not be checked. On the other hand, it's run automatically by "meson test". check-pot.py python script will detect all incorrect format strings, but it's not as easy to use as it requires libvirt.pot to be regenerated and this does not happen during a standard build. The following steps are needed to check messages with check-pot.py: meson compile libvirt-pot-dep meson compile libvirt-pot meson compile libvirt-pot-check Don't forget to revert changes to libvirt.pot if you run these commands locally as we don't want each patch series to update libvirt.pot. Shell scripts (tools/libvirt-guests.sh.in is the only one currently) need to be exempt from this check as shell's printf function does not understand the permutable format strings. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
36 lines
886 B
Meson
36 lines
886 B
Meson
i18n = import('i18n')
|
|
|
|
i18n.gettext(
|
|
meson.project_name(),
|
|
args: [
|
|
'--from-code=UTF-8',
|
|
'--keyword=_',
|
|
'--keyword=N_',
|
|
'--add-comments=TRANSLATORS:',
|
|
'--directory=@0@'.format(meson.project_source_root()),
|
|
'--directory=@0@'.format(meson.project_build_root()),
|
|
'--files-from=@0@'.format(meson.current_source_dir() / 'POTFILES'),
|
|
'--msgid-bugs-address=https://libvirt.org/bugs.html',
|
|
'--package-version=@0@'.format(meson.project_version()),
|
|
'--sort-output',
|
|
],
|
|
)
|
|
|
|
potfiles_dep = [
|
|
access_gen_sources,
|
|
admin_client_generated,
|
|
admin_driver_generated,
|
|
remote_driver_generated,
|
|
remote_daemon_generated,
|
|
]
|
|
|
|
alias_target('libvirt-pot-dep', potfiles_dep)
|
|
|
|
run_target(
|
|
'libvirt-pot-check',
|
|
command: [
|
|
'@0@/scripts/check-pot.py'.format(meson.project_source_root()),
|
|
'@0@/po/libvirt.pot'.format(meson.project_source_root())
|
|
],
|
|
)
|