Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript NodeJS Intl.RelativeTimeFormat仅返回英文字符串_Javascript_Node.js_Internationalization_Locale_Ecmascript Intl - Fatal编程技术网

Javascript NodeJS Intl.RelativeTimeFormat仅返回英文字符串

Javascript NodeJS Intl.RelativeTimeFormat仅返回英文字符串,javascript,node.js,internationalization,locale,ecmascript-intl,Javascript,Node.js,Internationalization,Locale,Ecmascript Intl,我试图在nodeJS中玩Intl,但它只输出英语,尽管我设置了不同的设置 这是我的尝试 $ node Welcome to Node.js v12.16.3. Type ".help" for more information. > const spanish = new Intl.RelativeTimeFormat('es-es') undefined > spanish.format(10, 'hours') 'in 10 hours' 这与我的地区设置有

我试图在nodeJS中玩
Intl
,但它只输出英语,尽管我设置了不同的设置

这是我的尝试

$ node
Welcome to Node.js v12.16.3.
Type ".help" for more information.
> const spanish = new Intl.RelativeTimeFormat('es-es')
undefined
> spanish.format(10, 'hours')
'in 10 hours'
这与我的
地区设置有关吗

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
(我在mac电脑上,以防万一)