pipewire: don't setlocale from pw_init, let parent app set it

Library code generally shouldn't modify global state, so pw_init()
should not result to changing the C locale.

Instead, set the C locale in main() for tools and daemons.

We'll still setlocale for LC_MESSAGES, to get translated UI elements in
wireplumber. This workaround should be removed eventually...
This commit is contained in:
Pauli Virtanen 2022-03-22 20:31:07 +02:00
parent b409792ea4
commit c66bb65c7a
13 changed files with 27 additions and 2 deletions

View file

@ -26,6 +26,7 @@
#include <signal.h>
#include <getopt.h>
#include <libgen.h>
#include <locale.h>
#include <spa/utils/result.h>
#include <pipewire/pipewire.h>
@ -74,6 +75,7 @@ int main(int argc, char *argv[])
snprintf(path, sizeof(path), "%s.conf", argv[0]);
config_name = basename(path);
setlocale(LC_ALL, "");
pw_init(&argc, &argv);
while ((c = getopt_long(argc, argv, "hVc:v", long_options, NULL)) != -1) {