From a8283001d9b0437f32348451dcf239f3147c9088 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 30 Mar 2025 23:09:53 +0300 Subject: [PATCH] po: extract translatable strings from wireplumber.conf Add rules to extract translatable strings from wireplumber.conf. Meson i18n.gettext does not support extracting strings from autogenerated files. Hence, we must commit conf.pot to repository. These setting descriptions are meant to be user-facing. Translating them allows also 3rd party apps to get the translations from 'wireplumber' domain. --- meson.build | 2 + po/POTFILES.in | 1 + po/conf.pot | 110 +++++++++++++++++++++++++++++++++++++++++ po/meson.build | 19 +++++++ src/config/meson.build | 2 + 5 files changed, 134 insertions(+) create mode 100644 po/conf.pot diff --git a/meson.build b/meson.build index e197d837..6ac70602 100644 --- a/meson.build +++ b/meson.build @@ -160,6 +160,8 @@ common_args = [ ] add_project_arguments(common_args, language: 'c') +i18n_conf = files() + subdir('lib') if build_modules subdir('modules') diff --git a/po/POTFILES.in b/po/POTFILES.in index b8da3c87..3f6d97da 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,3 +1,4 @@ src/scripts/monitors/alsa.lua src/scripts/monitors/bluez-midi.lua src/scripts/monitors/libcamera/name-node.lua +po/conf.pot diff --git a/po/conf.pot b/po/conf.pot new file mode 100644 index 00000000..1575ca2f --- /dev/null +++ b/po/conf.pot @@ -0,0 +1,110 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. /wireplumber.settings.schema/bluetooth.autoswitch-to-headset-profile/description +#: wireplumber.conf +msgid "Always show microphone for Bluetooth headsets, and switch to headset mode when recording" +msgstr "" + +#. /wireplumber.settings.schema/bluetooth.use-persistent-storage/description +#: wireplumber.conf +msgid "Remember and restore Bluetooth headset mode status" +msgstr "" + +#. /wireplumber.settings.schema/device.restore-profile/description +#: wireplumber.conf +msgid "Remember and restore device profiles" +msgstr "" + +#. /wireplumber.settings.schema/device.restore-routes/description +#: wireplumber.conf +msgid "Remember and restore device routes" +msgstr "" + +#. /wireplumber.settings.schema/device.routes.default-sink-volume/description +#: wireplumber.conf +msgid "The default volume for audio sinks" +msgstr "" + +#. /wireplumber.settings.schema/device.routes.default-source-volume/description +#: wireplumber.conf +msgid "The default volume for audio sources" +msgstr "" + +#. /wireplumber.settings.schema/linking.allow-moving-streams/description +#: wireplumber.conf +msgid "Streams may be moved by adding PipeWire metadata at runtime" +msgstr "" + +#. /wireplumber.settings.schema/linking.follow-default-target/description +#: wireplumber.conf +msgid "Streams connected to the default device follow when default changes" +msgstr "" + +#. /wireplumber.settings.schema/linking.pause-playback/description +#: wireplumber.conf +msgid "Pause media players if their target sink is removed" +msgstr "" + +#. /wireplumber.settings.schema/linking.role-based.duck-level/description +#: wireplumber.conf +msgid "The volume level to apply when ducking (= reducing volume for a higher priority stream to be audible) in the role-based linking policy" +msgstr "" + +#. /wireplumber.settings.schema/monitor.camera-discovery-timeout/description +#: wireplumber.conf +msgid "The camera discovery timeout in milliseconds" +msgstr "" + +#. /wireplumber.settings.schema/node.features.audio.control-port/description +#: wireplumber.conf +msgid "Enable control ports on audio nodes" +msgstr "" + +#. /wireplumber.settings.schema/node.features.audio.monitor-ports/description +#: wireplumber.conf +msgid "Enable monitor ports on audio nodes" +msgstr "" + +#. /wireplumber.settings.schema/node.features.audio.no-dsp/description +#: wireplumber.conf +msgid "Do not convert audio to F32 format" +msgstr "" + +#. /wireplumber.settings.schema/node.filter.forward-format/description +#: wireplumber.conf +msgid "Forward format on filter nodes or not" +msgstr "" + +#. /wireplumber.settings.schema/node.restore-default-targets/description +#: wireplumber.conf +msgid "Remember and restore default audio/video input/output devices" +msgstr "" + +#. /wireplumber.settings.schema/node.stream.default-capture-volume/description +#: wireplumber.conf +msgid "The default volume for capture nodes" +msgstr "" + +#. /wireplumber.settings.schema/node.stream.default-media-role/description +#: wireplumber.conf +msgid "Default media.role to assign on streams that do not specify it" +msgstr "" + +#. /wireplumber.settings.schema/node.stream.default-playback-volume/description +#: wireplumber.conf +msgid "The default volume for playback nodes" +msgstr "" + +#. /wireplumber.settings.schema/node.stream.restore-props/description +#: wireplumber.conf +msgid "Remember and restore properties of streams" +msgstr "" + +#. /wireplumber.settings.schema/node.stream.restore-target/description +#: wireplumber.conf +msgid "Remember and restore stream targets" +msgstr "" + diff --git a/po/meson.build b/po/meson.build index 199d12e6..4e088ea6 100644 --- a/po/meson.build +++ b/po/meson.build @@ -1,5 +1,24 @@ i18n = import('i18n') +pymod = import('python') +python_po = pymod.find_installation('python3') +spa_json_dump_po = find_program('spa-json-dump', required: false) + +if python_po.found() and spa_json_dump_po.found() + conf_pot = custom_target('conf.pot', + input : i18n_conf, + output : 'conf.pot', + build_by_default : true, + command : [ + python_po, spa_json_po, '--spa-json-dump=' + spa_json_dump_po.full_path(), + '-k', '/wireplumber.settings.schema/[^/]*/description$', + '-o', '@CURRENT_SOURCE_DIR@/conf.pot', + '@INPUT@', + ], + capture: true, + ) +endif + i18n.gettext( meson.project_name(), preset: 'glib', diff --git a/src/config/meson.build b/src/config/meson.build index 322e2c30..bdf69dc3 100644 --- a/src/config/meson.build +++ b/src/config/meson.build @@ -4,3 +4,5 @@ install_subdir('wireplumber.conf.d.examples', install_dir : wireplumber_doc_dir / 'examples' / 'wireplumber.conf.d', strip_directory : true, ) + +i18n_conf += files('wireplumber.conf')