国际化支持
【Internationalization support】
Node.js 有许多功能,使编写国际化程序变得更容易。其中一些功能包括:
【Node.js has many features that make it easier to write internationalized programs. Some of them are:】
- ECMAScript 语言规范 中的区域设置敏感或支持 Unicode 的函数:
- ECMAScript 国际化 API 规范(又名 ECMA-402)中描述的所有功能:
Intl对象- 像
String.prototype.localeCompare()和Date.prototype.toLocaleString()这样的区域敏感方法
- WHATWG URL 解析器 的 国际化域名(国际化域名)支持
require('node:buffer').transcode()- 更精确的 REPL 线路编辑
require('node:util').TextDecoderRegExpUnicode 属性转义
Node.js 和底层的 V8 引擎使用 国际 Unicode 组件(ICU) 在本地 C/C++ 代码中实现这些功能。Node.js 默认提供完整的 ICU 数据集。然而,由于 ICU 数据文件的大小,提供了几种选项用于在构建或运行 Node.js 时自定义 ICU 数据集。
【Node.js and the underlying V8 engine use International Components for Unicode (ICU) to implement these features in native C/C++ code. The full ICU data set is provided by Node.js by default. However, due to the size of the ICU data file, several options are provided for customizing the ICU data set either when building or running Node.js.】