meson: add gettext support

While runtime gettext support was already working,
this adds the missing piece of build integrations.

With these changes, three new targets are now available
to manage translation files:

- vlc-pot: Regenerates the .pot files using xgettext
- vlc-update-po: Regenerates the .po files from the current .pot files
- vlc-gmo: Builds (but not installs) the translations
This commit is contained in:
Marvin Scholz 2023-03-31 14:50:06 +02:00 committed by Jean-Baptiste Kempf
parent 8909317baf
commit e8b6a9324d
2 changed files with 20 additions and 0 deletions

View File

@ -173,6 +173,8 @@ intl_dep = dependency('intl', required: get_option('nls'))
if intl_dep.found()
cdata.set('HAVE_GETTEXT', 1)
cdata.set('ENABLE_NLS', 1)
subdir('po')
endif
# Domain name i18n support via GNU libidn

18
po/meson.build Normal file
View File

@ -0,0 +1,18 @@
i18n = import('i18n')
add_project_arguments(f'-DGETTEXT_PACKAGE="@vlc_package_name@"',
language: ['c', 'cpp', 'objc'])
i18n.gettext(vlc_package_name,
args: [
'--keyword=_',
'--keyword=N_',
'--keyword=_NS',
'--keyword=qtr',
'--keyword=Q_',
'--language=C++',
'--keyword=vlc_ngettext:1,2',
'--keyword=vlc_pgettext:1c,2',
'--keyword=_PNS:1c,2',
'--add-comments=xgettext:',
'--from-code=UTF-8',
])