如何在 git-gui 中设置所需的语言?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1427785/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to set desired language in git-gui?
提问by
I recently came to git for a project I participate to. I found git gui rather handy (under OSX Snow Leopard) to srtat with but I would much like if it were not localized (in French, in my case). Is there preference or hack to have git gui displayed in english?
我最近为了一个我参与的项目来到 git。我发现 git gui 相当方便(在 OSX Snow Leopard 下)与 srtat 一起使用,但我非常希望它没有本地化(在我的情况下是法语)。是否有偏好或黑客以英语显示 git gui?
回答by Oleg Sakharov
For Windowsusers the are two choices as well:
对于Windows用户,也有两种选择:
1) Set the LANG environment variable to en.
1) 将 LANG 环境变量设置为en。
a) Overall for Windows: http://www.itechtalk.com/thread3595.html
a) Windows 总体:http: //www.itechtalk.com/thread3595.html
b) For the git shell only:
b) 仅适用于 git shell:
If you don't want to affect anything else except git applications you might add the following line in the beginning of C:\Program Files\Git\cmd\git.cmdfile:
如果您不想影响除 git 应用程序之外的任何其他内容,您可以在C:\Program Files\Git\cmd\git.cmd文件的开头添加以下行:
@set LANG=en
Please note that this will only work when launching commands from the git shell - GIT GUI launched from the start menu will not be affected
请注意,这仅在从 git shell 启动命令时有效 - 从开始菜单启动的 GIT GUI 不会受到影响
2) Delete or rename relevant *.msg file in C:\Program Files\Git\share\git-gui\lib\msgs
2) 删除或重命名 C:\Program Files\Git\share\git-gui\lib\msgs 中的相关 *.msg 文件
You save on not modifying any setup shell (especially if you use cmd.exe shells) but you lose on international functionality.
您无需修改任何设置外壳程序(尤其是如果您使用 cmd.exe 外壳程序),但您会失去国际功能。
Credits:These answers originated in the official issue raised in msysgitproject which can be found here: http://code.google.com/p/msysgit/issues/detail?id=302
积分:这些答案起源于msysgit项目中提出的官方问题,可以在这里找到:http: //code.google.com/p/msysgit/issues/detail? id=302
回答by Joakim Elofsson
You could remove/rename the translation file from the install, french would be
您可以从安装中删除/重命名翻译文件,法语将是
... /share/git-gui/lib/msgs/fr.msg
Don't know about OS-X, but under windows (msysgit) that would normally be C:\Program Files\Git\share\git-gui\lib\msgs\, and on Linux (and others) /usr/share/git-gui/lib/msgs/ .
不知道 OS-X,但在 windows (msysgit) 下通常是 C:\Program Files\Git\share\git-gui\lib\msgs\,在 Linux(和其他)上 /usr/share/ git-gui/lib/msgs/ 。
(and gitk ... /share/gitk/lib/msgs/ )
(和 gitk ... /share/gitk/lib/msgs/ )
回答by Andrey Betenev
Note that setting @set LANG=en
in cmd file helps, but only when you start GitGUI with that cmd file. This is not the case when you start it from the Start menu: it calls wish.exe directly. If you change the link to run cmd script, it shows text command window along with GUI, which is unwanted. That is why for me renaming .msg file is a way of choice.
请注意,@set LANG=en
在 cmd 文件中进行设置会有所帮助,但前提是您使用该 cmd 文件启动 GitGUI。当您从“开始”菜单启动它时,情况并非如此:它直接调用 Wish.exe。如果您更改链接以运行 cmd 脚本,它会显示文本命令窗口和 GUI,这是不需要的。这就是为什么对我来说重命名 .msg 文件是一种选择。
回答by xmoex
For Linuxyou can use from a terminal:
对于Linux,您可以从终端使用:
LC_ALL=en_US.utf8 git gui
to start your git-gui for example temporary in english from your current terminal. This solution will affect onlyyour current instance of git-gui and nothing else. Credit goes to Junio C Hamano
从您当前的终端启动您的 git-gui 例如临时的英语。该解决方案将影响只有你的混帐GUI,别无其他的当前实例。幸得JUNIOÇ滨野
Update for use in *.desktop files (persistent solution):
用于 *.desktop 文件的更新(持久解决方案):
To always start a program with the desired locale setting from your *.desktop file you have to modify it's Exec=...
section to start in a modified environment.
要始终使用 *.desktop 文件中的所需语言环境设置启动程序,您必须修改它的Exec=...
部分以在修改后的环境中启动。
From:
从:
...
Exec="/usr/bin/your-program"
...
To:
到:
...
Exec=env LC_ALL=en_US.utf8 "/usr/bin/your-program"
...
Update for missing locales:
更新缺少的语言环境:
Sometimes your system might complain with:
有时您的系统可能会抱怨:
-bash: warning: setlocale: LC_ALL: cannot change locale (en_US)
In this case you most likely don't have the proper locale generated, yet. (If you see English text nevertheless it's probably your system that's using the C
locale as a fallback)
在这种情况下,您很可能还没有生成正确的语言环境。(如果您仍然看到英文文本,则可能是您的系统使用C
区域设置作为后备)
Generating the missing locale:
生成缺少的语言环境:
回答by Michael Krelin - hacker
export LANG=en_US
should do. It will affect everything you run from this shell, though.
应该做。但是,它会影响您从此 shell 运行的所有内容。