About multi-lingual support on MinGW

May 30, 2022 at 8:36am
One day I downloaded a version of MinGW. When I was trying using it to compile a C++ source file, I found that, took me by surprise, the compiler can produce Chinese output like "严重错误:没有输入文件。 编译中断。". But I lose the compiler and never find it again.
I found some translation files under (MinGW installstion folder)\share\locale\zh_CN, but I don't know how how to apply them.
Therefore, are there any way to make the MinGW compiler produce chinese output or apply the translation files?
May 30, 2022 at 9:09am
First of all, the original "MinGW.org" project is pretty much dead, for a long time now.

You really should be using Mingw-w64 these days!
https://www.mingw-w64.org/

I recommend to install Mingw-w64 and the associated build tools (bash, make, etc.) via MSYS2:
https://www.msys2.org/


Furthermore, gcc and g++ should respect the usual LC_* environment variables to set the locale:
https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html#Environment-Variables/

The LC_MESSAGES environment variable specifies the language to use in diagnostic messages.

...so you can try this:
1
2
export LC_MESSAGES=zh_CN
gcc <your parameters here>
Last edited on May 30, 2022 at 9:28am
May 30, 2022 at 2:22pm
@kigar64551

I am using Windows, so I use set LC_MESSAGES=zh_CN, then I type gccbut it still gives me English output. Here is the output:

gcc: fatal error: no input files
compilation terminated.
May 30, 2022 at 4:18pm
Even on Windows you won't get far without a "proper" Shell (i.e. bash) and the other usual build tools, such as GNU make. Therefore the recommendation to use MSYS2, which will give you not only the latest version of mingw-w64 (they provide gcc as well as clang), but also a full "Unix-like" environment with bash and make tools. In fact, in MSYS2, you can simply install whatever you need with the pacman package manager.

Anyway, for me LC_MESSAGES=zh_CN does works with pacman, but not with gcc:
https://i.imgur.com/kx6dHPV.png

...which is not much of a surprise, because there is no "gcc.mo" or "cc1.mo" in my directory:
C:\msys64\usr\share\locale\zh_CN\LC_MESSAGES

Not sure, whether I'm missing a required package, or they simply didn't build gcc with locale support ?!

Maybe you want to ask here, which is more likely to give you an answer:
https://www.msys2.org/contact/
Last edited on May 30, 2022 at 4:51pm
May 31, 2022 at 10:02am
@kigar64551

I found that when I am under Windows 7 the MinGW compiler can produce Chinese output (without setting LC_MESSAGES), but under Windows 10 it cannot.
Topic archived. No new replies allowed.