public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* --enable-nls doesn't work as expected
@ 2024-01-05 11:05 niXman
  2024-01-05 11:19 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: niXman @ 2024-01-05 11:05 UTC (permalink / raw)
  To: Gcc Help

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?



best!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --enable-nls doesn't work as expected
  2024-01-05 11:05 --enable-nls doesn't work as expected niXman
@ 2024-01-05 11:19 ` Jonathan Wakely
  2024-01-05 12:03   ` niXman
  2024-01-05 12:24   ` LIU Hao
  0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Wakely @ 2024-01-05 11:19 UTC (permalink / raw)
  To: niXman; +Cc: Gcc Help

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";
     | ^~~~~


Are you able to reproduce this yourself, using your build? 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --enable-nls doesn't work as expected
  2024-01-05 11:19 ` Jonathan Wakely
@ 2024-01-05 12:03   ` niXman
  2024-01-05 12:24   ` LIU Hao
  1 sibling, 0 replies; 4+ messages in thread
From: niXman @ 2024-01-05 12:03 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Gcc Help

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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: --enable-nls doesn't work as expected
  2024-01-05 11:19 ` Jonathan Wakely
  2024-01-05 12:03   ` niXman
@ 2024-01-05 12:24   ` LIU Hao
  1 sibling, 0 replies; 4+ messages in thread
From: LIU Hao @ 2024-01-05 12:24 UTC (permalink / raw)
  To: Jonathan Wakely, niXman; +Cc: Gcc Help


[-- Attachment #1.1: Type: text/plain, Size: 627 bytes --]

在 2024/1/5 19:19, Jonathan Wakely via Gcc-help 写道:
> 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:

Do you know where cc1plus looks for .mo files?

On Windows there are no unified absolute paths, so I suspect gettext looks by relative path. For 
gcc, messages can be found in '../share/locales/zh_CN/LC_MESSAGES/', but for cc1plus this won't be 
correct.

-- 
Best regards,
LIU Hao


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-05 12:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05 11:05 --enable-nls doesn't work as expected niXman
2024-01-05 11:19 ` Jonathan Wakely
2024-01-05 12:03   ` niXman
2024-01-05 12:24   ` LIU Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).