My error messages are displayed in French. How can I change my system language setting so the error messages will be displayed in English?
我的错误信息以法语显示。如何更改系统语言设置,使错误消息以英文显示?
14 个解决方案
#1
81
You can set this using the Sys.setenv()
function. My R session defaults to English, so I'll set it to French and then back again:
您可以使用Sys.setenv()函数设置它。我的R会话默认为英语,所以我将它设置为法语,然后再返回:
> Sys.setenv(LANG = "fr")
> 2 + x
Erreur : objet 'x' introuvable
> Sys.setenv(LANG = "en")
> 2 + x
Error: object 'x' not found
A list of the abbreviations can be found here.
缩写的列表可以在这里找到。
Sys.getenv()
gives you a list of all the environment variables that are set.
Sys.getenv()提供了设置的所有环境变量的列表。
#2
20
In the case of RStudio for Windows I succeeded in changing the language following the instructions found in R for Windows FAQ, in particular I wrote:
对于Windows的RStudio,我成功地按照Windows FAQ在R中找到的说明更改了语言,特别是我写道:
language = EN
inside the file Rconsole
(in my installation it is C:\Program Files\R\R-2.15.2\etc\Rconsole
); this works also for the command Rscript
.
内部文件Rconsole(在我安装C:\Program Files\R\R-2.15.2\etc\ Rconsole);这也适用于命令Rscript。
For example you can locate the Rconsole
file with this two commands from a command prompt:
例如,您可以使用命令提示符中的这两个命令找到Rconsole文件:
cd \
cd \
dir Rconsole /s
dir Rconsole /秒
The first one make the root as the current directory, the second one looks for the Rconsole
file.
第一个将根作为当前目录,第二个将查找Rconsole文件。
In the following screenshot you have that Rconsole
file is in the folder C:\Program Files\R\R-3.4.1\etc
.
在以下截图C:\Program Files\R\R-3.4.1\etc. Rconsole文件的文件夹
You may have more than one location, in that case you may edit all the Rconsole
files.
您可能有多个位置,在这种情况下,您可以编辑所有Rconsole文件。
After that you can open the Rconsole
file with your favorite editor and look for the line language =
and then append EN
at the end of that line.
之后,您可以使用您最喜欢的编辑器打开Rconsole文件,并查找line language =,然后在该行末尾追加EN。
In the following screenshot the interesting line is the number 70 and you have to append EN
at the end of it.
在下面的截图中,有趣的线是数字70,你必须在它的结尾追加。
#3
17
For mac users, I found this on the R for Mac FAQ
对于mac用户,我在mac FAQ的R上发现了这一点
If you use a non-standard setup (e.g. different language than formats), you can override the auto-detection performed by setting `force.LANG' defaults setting, such as for example
如果您使用非标准设置(例如,不同的语言和格式),您可以覆盖通过设置“force”执行的自动检测。LANG的默认设置,例如
defaults write org.R-project.R force.LANG en_US.UTF-8
when run in Terminal it will enforce US-english setting regardless of the system setting. If you don't know what Terminal is you can use this R command instead:
当在终端上运行时,它将强制执行US-english设置,而不考虑系统设置。如果你不知道终端是什么,你可以用这个R命令来代替:
system("defaults write org.R-project.R force.LANG en_US.UTF-8")
but do not forget to quit R and start R.app again afterwards. Please note that you must always use `.UTF-8' version of the locale, otherwise R.app will not work properly.
但是不要忘记退出R并开始R。再次应用。请注意,你必须经常使用。地区的UTF-8版本,否则R。app不能正常工作。
This helped me to change my console language from Chinese to English.
这帮助我将我的控制台语言从中文改为英文。
#4
8
This works from command line :
这是从命令行开始工作的:
$ export LANG=en_US.UTF-8
None of the other answers above worked for me
以上的答案对我都不起作用
#5
6
If you use Ubuntu you will set
如果你使用Ubuntu,你将设置
LANGUAGE=en
in /etc/R/Renviron.site.
在/etc/R/Renviron.site。
#6
4
You may also want to be aware of the difference between, for example, Sys.setenv(LANG = "ru")
and Sys.setlocale(locale = "ru_RU.utf8")
.
您可能还想知道,例如,Sys。setenv(LANG = "ru")和Sys。setlocale(locale =“ru_RU.utf8”)。
> Sys.setlocale(locale = "ru_RU.utf8")
[1] "LC_CTYPE=ru_RU.utf8;LC_NUMERIC=C;LC_TIME=ru_RU.utf8;LC_COLLATE=ru_RU.utf8;LC_MONETARY=ru_RU.utf8;LC_MESSAGES=en_IE.utf8;LC_PAPER=en_IE.utf8;LC_NAME=en_IE.utf8;LC_ADDRESS=en_IE.utf8;LC_TELEPHONE=en_IE.utf8;LC_MEASUREMENT=en_IE.utf8;LC_IDENTIFICATION=en_IE.utf8"
If you are interested in changing the behaviour of functions that refer to one of these elements (e.g strptime
to extract dates), you should use Sys.setlocale()
. See ?Sys.setlocale
for more details. In order to see all available languages on a linux system, you can run
如果您对更改引用其中一个元素的函数的行为感兴趣(e)。g strptime来提取日期),您应该使用Sys.setlocale()。看到了什么?系统。setlocale为更多的细节。为了在linux系统上看到所有可用的语言,您可以运行。
system("locale -a", intern = TRUE)
#7
2
type this first: system("defaults write org.R-project.R force.LANG en_US.UTF-8") then you will get a index number(in my case is 127)
首先输入这个:system(“默认写入org.R-project”)。R的力量。然后你会得到一个索引号(在我的例子中是127)
then type: Sys.setenv(LANG = "en") then type the number and ENTER 127
然后输入:Sys。然后输入数字并输入127
#8
2
A simple solution would be setting export Lang=C in your bash script. I had a similar issue where the default language was german so it reverted back to english.
一个简单的解决方案是在您的bash脚本中设置export Lang=C。我有一个类似的问题,默认语言是德语,所以它又回到了英语。
#9
2
you simply have to change the basic language of microsoft on your computer!
你只需在你的电脑上改变微软的基本语言!
press the windows button together with r, and tip the following code into the window that is opened
用r按下windows按钮,将下面的代码提示到打开的窗口中
control.exe /name Microsoft.Language
控制。exe Microsoft.Language /名称
load the language package you want to use and change the options. but take care, this will change also your keyboard layout!
加载您想要使用的语言包并更改选项。但是保重,这也会改变你的键盘布局!
#10
0
Im using R Studio on a Mac and I couldn't find the Rconsole file. So I took a more brutal way and just deleted the unwanted language files from the R app. You just have to go to your Rapp in your application Folder, right click, show package content then /contents/Resources/. There are the language files e.g. English.lproj or in my case de.lproj wich I deleted. After restarting R, error messages appear in English.. Maybe thats helpful!
我在Mac电脑上使用R Studio,却找不到Rconsole文件。所以我采取了更残忍的方式,从R应用中删除了不需要的语言文件。有一些语言文件,例如英语。我把它删掉了。重新启动R后,错误消息出现在英语中。也许这是有帮助的!
#11
0
In Ubuntu 14.04 LTS I had to remove the #
from the comment #LANGUAGE=EN
.
All other options din not work for me.
在Ubuntu 14.04 LTS中,我必须从注释#LANGUAGE=EN中删除#。所有其他的选择都不适合我。
#12
0
For me worked:
对我来说工作:
Sys.setlocale("LC_MESSAGES", "en_US.utf8")
Testing:
测试:
> Sys.setlocale("LC_MESSAGES", "en_US.utf8")
[1] "en_US.utf8"
> x[3]
Error: object 'x' not found
Here is the start of my sessionInfo
:
以下是我的会议信息的开始:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
#13
0
If you want to change R's language in terminal to English forever, this works fine for me in macOS:
如果你想永远把R的语言换成英语,这对macOS的我来说很好:
Open terminal.app, and say:
打开终端。程序,说:
touch .bash_profile
Then say:
然后说:
open -a TextEdit.app .bash_profile
These two commands will help you open ".bash_profile" file in TextEdit.
这两个命令将帮助您打开。在文本编辑bash_profile”文件。
Add this to ".bash_profile" file:
添加这个”。bash_profile”文件:
export LANG=en_US.UTF-8
Then save the file, reopen terminal and type R
, you will find it's language has changed to english.
然后保存文件,重新打开终端,输入R,你会发现它的语言已经变成了英语。
If you want language come back to it's original, just simply add a #
before export LANG=en_US.UTF-8
.
如果您希望语言恢复到原来的状态,只需在导出LANG=en_US.UTF-8之前添加一个#。
#14
0
The only thing that worked for me was uninstalling R entirely (make sure to remove it from the Programs files as well), and install it, but unselect Message Translations during the installation process. When I installed R, and subsequently RCmdr, it finally came up in English.
唯一对我有用的是完全卸载R(确保也从程序文件中删除它),并安装它,但是在安装过程中取消选择消息转换。当我安装了R,并随后安装了RCmdr,它最终以英语出现。
#1
81
You can set this using the Sys.setenv()
function. My R session defaults to English, so I'll set it to French and then back again:
您可以使用Sys.setenv()函数设置它。我的R会话默认为英语,所以我将它设置为法语,然后再返回:
> Sys.setenv(LANG = "fr")
> 2 + x
Erreur : objet 'x' introuvable
> Sys.setenv(LANG = "en")
> 2 + x
Error: object 'x' not found
A list of the abbreviations can be found here.
缩写的列表可以在这里找到。
Sys.getenv()
gives you a list of all the environment variables that are set.
Sys.getenv()提供了设置的所有环境变量的列表。
#2
20
In the case of RStudio for Windows I succeeded in changing the language following the instructions found in R for Windows FAQ, in particular I wrote:
对于Windows的RStudio,我成功地按照Windows FAQ在R中找到的说明更改了语言,特别是我写道:
language = EN
inside the file Rconsole
(in my installation it is C:\Program Files\R\R-2.15.2\etc\Rconsole
); this works also for the command Rscript
.
内部文件Rconsole(在我安装C:\Program Files\R\R-2.15.2\etc\ Rconsole);这也适用于命令Rscript。
For example you can locate the Rconsole
file with this two commands from a command prompt:
例如,您可以使用命令提示符中的这两个命令找到Rconsole文件:
cd \
cd \
dir Rconsole /s
dir Rconsole /秒
The first one make the root as the current directory, the second one looks for the Rconsole
file.
第一个将根作为当前目录,第二个将查找Rconsole文件。
In the following screenshot you have that Rconsole
file is in the folder C:\Program Files\R\R-3.4.1\etc
.
在以下截图C:\Program Files\R\R-3.4.1\etc. Rconsole文件的文件夹
You may have more than one location, in that case you may edit all the Rconsole
files.
您可能有多个位置,在这种情况下,您可以编辑所有Rconsole文件。
After that you can open the Rconsole
file with your favorite editor and look for the line language =
and then append EN
at the end of that line.
之后,您可以使用您最喜欢的编辑器打开Rconsole文件,并查找line language =,然后在该行末尾追加EN。
In the following screenshot the interesting line is the number 70 and you have to append EN
at the end of it.
在下面的截图中,有趣的线是数字70,你必须在它的结尾追加。
#3
17
For mac users, I found this on the R for Mac FAQ
对于mac用户,我在mac FAQ的R上发现了这一点
If you use a non-standard setup (e.g. different language than formats), you can override the auto-detection performed by setting `force.LANG' defaults setting, such as for example
如果您使用非标准设置(例如,不同的语言和格式),您可以覆盖通过设置“force”执行的自动检测。LANG的默认设置,例如
defaults write org.R-project.R force.LANG en_US.UTF-8
when run in Terminal it will enforce US-english setting regardless of the system setting. If you don't know what Terminal is you can use this R command instead:
当在终端上运行时,它将强制执行US-english设置,而不考虑系统设置。如果你不知道终端是什么,你可以用这个R命令来代替:
system("defaults write org.R-project.R force.LANG en_US.UTF-8")
but do not forget to quit R and start R.app again afterwards. Please note that you must always use `.UTF-8' version of the locale, otherwise R.app will not work properly.
但是不要忘记退出R并开始R。再次应用。请注意,你必须经常使用。地区的UTF-8版本,否则R。app不能正常工作。
This helped me to change my console language from Chinese to English.
这帮助我将我的控制台语言从中文改为英文。
#4
8
This works from command line :
这是从命令行开始工作的:
$ export LANG=en_US.UTF-8
None of the other answers above worked for me
以上的答案对我都不起作用
#5
6
If you use Ubuntu you will set
如果你使用Ubuntu,你将设置
LANGUAGE=en
in /etc/R/Renviron.site.
在/etc/R/Renviron.site。
#6
4
You may also want to be aware of the difference between, for example, Sys.setenv(LANG = "ru")
and Sys.setlocale(locale = "ru_RU.utf8")
.
您可能还想知道,例如,Sys。setenv(LANG = "ru")和Sys。setlocale(locale =“ru_RU.utf8”)。
> Sys.setlocale(locale = "ru_RU.utf8")
[1] "LC_CTYPE=ru_RU.utf8;LC_NUMERIC=C;LC_TIME=ru_RU.utf8;LC_COLLATE=ru_RU.utf8;LC_MONETARY=ru_RU.utf8;LC_MESSAGES=en_IE.utf8;LC_PAPER=en_IE.utf8;LC_NAME=en_IE.utf8;LC_ADDRESS=en_IE.utf8;LC_TELEPHONE=en_IE.utf8;LC_MEASUREMENT=en_IE.utf8;LC_IDENTIFICATION=en_IE.utf8"
If you are interested in changing the behaviour of functions that refer to one of these elements (e.g strptime
to extract dates), you should use Sys.setlocale()
. See ?Sys.setlocale
for more details. In order to see all available languages on a linux system, you can run
如果您对更改引用其中一个元素的函数的行为感兴趣(e)。g strptime来提取日期),您应该使用Sys.setlocale()。看到了什么?系统。setlocale为更多的细节。为了在linux系统上看到所有可用的语言,您可以运行。
system("locale -a", intern = TRUE)
#7
2
type this first: system("defaults write org.R-project.R force.LANG en_US.UTF-8") then you will get a index number(in my case is 127)
首先输入这个:system(“默认写入org.R-project”)。R的力量。然后你会得到一个索引号(在我的例子中是127)
then type: Sys.setenv(LANG = "en") then type the number and ENTER 127
然后输入:Sys。然后输入数字并输入127
#8
2
A simple solution would be setting export Lang=C in your bash script. I had a similar issue where the default language was german so it reverted back to english.
一个简单的解决方案是在您的bash脚本中设置export Lang=C。我有一个类似的问题,默认语言是德语,所以它又回到了英语。
#9
2
you simply have to change the basic language of microsoft on your computer!
你只需在你的电脑上改变微软的基本语言!
press the windows button together with r, and tip the following code into the window that is opened
用r按下windows按钮,将下面的代码提示到打开的窗口中
control.exe /name Microsoft.Language
控制。exe Microsoft.Language /名称
load the language package you want to use and change the options. but take care, this will change also your keyboard layout!
加载您想要使用的语言包并更改选项。但是保重,这也会改变你的键盘布局!
#10
0
Im using R Studio on a Mac and I couldn't find the Rconsole file. So I took a more brutal way and just deleted the unwanted language files from the R app. You just have to go to your Rapp in your application Folder, right click, show package content then /contents/Resources/. There are the language files e.g. English.lproj or in my case de.lproj wich I deleted. After restarting R, error messages appear in English.. Maybe thats helpful!
我在Mac电脑上使用R Studio,却找不到Rconsole文件。所以我采取了更残忍的方式,从R应用中删除了不需要的语言文件。有一些语言文件,例如英语。我把它删掉了。重新启动R后,错误消息出现在英语中。也许这是有帮助的!
#11
0
In Ubuntu 14.04 LTS I had to remove the #
from the comment #LANGUAGE=EN
.
All other options din not work for me.
在Ubuntu 14.04 LTS中,我必须从注释#LANGUAGE=EN中删除#。所有其他的选择都不适合我。
#12
0
For me worked:
对我来说工作:
Sys.setlocale("LC_MESSAGES", "en_US.utf8")
Testing:
测试:
> Sys.setlocale("LC_MESSAGES", "en_US.utf8")
[1] "en_US.utf8"
> x[3]
Error: object 'x' not found
Here is the start of my sessionInfo
:
以下是我的会议信息的开始:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS
#13
0
If you want to change R's language in terminal to English forever, this works fine for me in macOS:
如果你想永远把R的语言换成英语,这对macOS的我来说很好:
Open terminal.app, and say:
打开终端。程序,说:
touch .bash_profile
Then say:
然后说:
open -a TextEdit.app .bash_profile
These two commands will help you open ".bash_profile" file in TextEdit.
这两个命令将帮助您打开。在文本编辑bash_profile”文件。
Add this to ".bash_profile" file:
添加这个”。bash_profile”文件:
export LANG=en_US.UTF-8
Then save the file, reopen terminal and type R
, you will find it's language has changed to english.
然后保存文件,重新打开终端,输入R,你会发现它的语言已经变成了英语。
If you want language come back to it's original, just simply add a #
before export LANG=en_US.UTF-8
.
如果您希望语言恢复到原来的状态,只需在导出LANG=en_US.UTF-8之前添加一个#。
#14
0
The only thing that worked for me was uninstalling R entirely (make sure to remove it from the Programs files as well), and install it, but unselect Message Translations during the installation process. When I installed R, and subsequently RCmdr, it finally came up in English.
唯一对我有用的是完全卸载R(确保也从程序文件中删除它),并安装它,但是在安装过程中取消选择消息转换。当我安装了R,并随后安装了RCmdr,它最终以英语出现。