Pazartesi 24 Ocak 2011 günü (saat 16:18:40) David Zeuthen şunları yazmıştı: > We should probably change the GObject API to pass getenv("LANG") if > non-NULL or something.
I've written a patch to get locale using getenv("LANG"), but pkaction command gave segfault with that. Some applications that does not set any locale, and use C locale by default may be desinged to print only ASCII strings, so I think getting locale using environment is not a good idea. I've written a second patch (attached) to use setlocale to get locale, and it works fine. pkaction does not crash and it prints message and descriptions in English always, but my Qt application prints message and description in Turkish, as it supposed to do. Ideas? -- Gökçen Eraslan
Index: polkit-0.99/src/polkit/polkitauthority.c =================================================================== --- polkit-0.99.orig/src/polkit/polkitauthority.c +++ polkit-0.99/src/polkit/polkitauthority.c @@ -23,6 +23,8 @@ # include "config.h" #endif +#include <locale.h> + #include "polkitauthorizationresult.h" #include "polkitcheckauthorizationflags.h" #include "polkitauthority.h" @@ -650,10 +652,13 @@ polkit_authority_enumerate_actions (Polk { g_return_if_fail (POLKIT_IS_AUTHORITY (authority)); g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable)); + + char *locale = setlocale(LC_MESSAGES, NULL); + g_dbus_proxy_call (authority->proxy, "EnumerateActions", g_variant_new ("(s)", - ""), /* TODO: use system locale */ + locale ? locale : ""), G_DBUS_CALL_FLAGS_NONE, -1, cancellable,
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ polkit-devel mailing list polkit-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/polkit-devel