--enable-nls doesn't work as expected
niXman
i.nixman@autistici.org
Fri Jan 5 12:03:32 GMT 2024
On 2024-01-05 11:19, Jonathan Wakely wrote:
> On Fri, 5 Jan 2024 at 11:06, niXman via Gcc-help <gcc-help@gcc.gnu.org>
> wrote:
>>
>> hello,
>>
>> in my MinGW-builds (https://github.com/niXman/mingw-builds) projects I
>> use `--disable-nls` by default and all works as expected.
>>
>> but I received a request to enable NLS support:
>> https://github.com/niXman/mingw-builds/issues/666
>>
>> the problem is when using `--enable-nls` the built compiler outputs
>> messages for the `gcc` or `gcc -v` or `gcc --help` commands in the
>> language of the user's locale (in this case Chinese), but the error
>> messages it still outputs in English:
>> https://github.com/niXman/mingw-builds/issues/666#issuecomment-1878064389
>>
>> any ideas?
>
> That should work fine. The zh_CN.po file contains translations for
> "error" and "%qD was not declared in this scope" so if the first
> command uses the translated strings, then the second one should too.
>
> It works perfectly for me using a native linux compiler:
>
> $ LANG=zh_CN.utf-8 gcc hello.cpp
> hello.cpp: In function ‘int main()’:
> hello.cpp:3:1: 错误:‘cout1’在此作用域中尚未声明>
> 3 | cout1 << "Hello";
> | ^~~~~
hello Jonathan,
> Are you able to reproduce this yourself, using your build?
no, unfortunately I don't have access to Windows OS...
I forwarded your questions to the user.
> I would
> check it, to make sure it isn't just user error, e.g. forgetting to
> set the locale in the environment for the second command. You should
> also ask the user how they're setting the locale. i.e. do some basic
> triage and analysis of the issue report.
best!
More information about the Gcc-help
mailing list