diff mbox

[6/6] gtk: setlocale for LC_MESSAGES only

Message ID 1441790938-29042-7-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Sept. 9, 2015, 9:28 a.m. UTC
Setting other LC_* affects printf behavior and breaks QMP.
We don't have much beside menu item strings localized, so
restrict the locale setting to LC_MESSAGES.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Sept. 9, 2015, 3:14 p.m. UTC | #1
Hi

On Wed, Sep 9, 2015 at 11:48 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 09/09/2015 11:28, Gerd Hoffmann wrote:
>> Setting other LC_* affects printf behavior and breaks QMP.
>> We don't have much beside menu item strings localized, so
>> restrict the locale setting to LC_MESSAGES.
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>
> Cc: qemu-stable@nongnu.org
>
>> ---
>>  ui/gtk.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/ui/gtk.c b/ui/gtk.c
>> index a17b1d1..a0b2340 100644
>> --- a/ui/gtk.c
>> +++ b/ui/gtk.c
>> @@ -1950,7 +1950,7 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
>>
>>      s->free_scale = FALSE;
>>
>> -    setlocale(LC_ALL, "");
>> +    setlocale(LC_MESSAGES, "");
>>      bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
>>      textdomain("qemu");
>>
>>
>

Don't it need gtk_disable_setlocale() too? (it's marked deprecated in
gtk2, but not in gtk3 interesting)

In the previous thread, Markus suggested a fat comment, you could
place it above the call.
diff mbox

Patch

diff --git a/ui/gtk.c b/ui/gtk.c
index a17b1d1..a0b2340 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1950,7 +1950,7 @@  void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
 
     s->free_scale = FALSE;
 
-    setlocale(LC_ALL, "");
+    setlocale(LC_MESSAGES, "");
     bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
     textdomain("qemu");