Re: [Gimp-developer] wget plugin



On 1 April 2012 11:31, Mukund Sivaraman <muks banu com> wrote:
> Hi Alexandre
>
> On Sun, Apr 01, 2012 at 12:56:54PM +0400, Alexandre Prokoudine wrote:
>> Hi,
>>
>> I've been wondering for a while why the plug-in for fetching an image
>> from network location always shows its messages in English, so I ended
>> up looking into the code...
>>
>> plug-ins/file-uri/uri-backend-wget.c has this:
>>
>>       g_setenv ("LANGUAGE", "C", TRUE);
>>       g_setenv ("LC_ALL", "C", TRUE);
>>       g_setenv ("LANG", "C", TRUE);
>>
>> And then translatable messages follow.
>>
>> So the plug-in doesn't even give those messages a chance to show up as
>> translated, while providing false hope :)
>>
>> Is there a reason for such a cruelty? :)
>
> The plug-in parses the output of wget to gather the status of what
> happened.  So it needs the output of wget in the C locale, so it has
> just 1 variant to compare.

It does the setenv after forking, so it shouldn't affect messages
getting translated in the parent process:

  else if (pid == 0)
    {
      gchar timeout_str[16];

      close (p[0]);
      close (2);
      dup (p[1]);
      close (p[1]);

      /* produce deterministic output */
      g_setenv ("LANGUAGE", "C", TRUE);
      g_setenv ("LC_ALL", "C", TRUE);
      g_setenv ("LANG", "C", TRUE);

      g_snprintf (timeout_str, sizeof (timeout_str), "%d", TIMEOUT);

      execlp ("wget",
              "wget", "-v", "-e", "server-response=off",
"--progress=dot", "-T", timeout_str,
              uri, "-O", tmpname, NULL);
      _exit (127);
    }


-- 
Mikael Magnusson


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]