构建 Node.js 的选项


🌐 Options for building Node.js

要控制 Node.js 中 ICU 的使用,在编译过程中可以使用四个 configure 选项。有关如何编译 Node.js 的更多详细信息,请参见 BUILDING.md

🌐 To control how ICU is used in Node.js, four configure options are available during compilation. Additional details on how to compile Node.js are documented in BUILDING.md.

  • --with-intl=none/--without-intl
  • --with-intl=system-icu
  • --with-intl=small-icu
  • --with-intl=full-icu(默认)

每个 configure 选项可用的 Node.js 和 JavaScript 功能概览:

🌐 An overview of available Node.js and JavaScript features for each configure option:

Featurenonesystem-icusmall-icufull-icu
String.prototype.normalize()none (function is no-op)fullfullfull
String.prototype.to*Case()fullfullfullfull
Intlnone (object does not exist)partial/full (depends on OS)partial (English-only)full
String.prototype.localeCompare()partial (not locale-aware)fullfullfull
String.prototype.toLocale*Case()partial (not locale-aware)fullfullfull
Number.prototype.toLocaleString()partial (not locale-aware)partial/full (depends on OS)partial (English-only)full
Date.prototype.toLocale*String()partial (not locale-aware)partial/full (depends on OS)partial (English-only)full
Legacy URL Parserpartial (no IDN support)fullfullfull
WHATWG URL Parserpartial (no IDN support)fullfullfull
require('node:buffer').transcode()none (function does not exist)fullfullfull
REPLpartial (inaccurate line editing)fullfullfull
require('node:util').TextDecoderpartial (basic encodings support)partial/full (depends on OS)partial (Unicode-only)full
RegExp Unicode Property Escapesnone (invalid RegExp error)fullfullfull

“(非地区感知)”的标记表示该函数的操作方式与非 Locale 版本的函数相同(如果存在的话)。例如,在 none 模式下,Date.prototype.toLocaleString() 的操作与 Date.prototype.toString() 的操作完全相同。

🌐 The "(not locale-aware)" designation denotes that the function carries out its operation just like the non-Locale version of the function, if one exists. For example, under none mode, Date.prototype.toLocaleString()'s operation is identical to that of Date.prototype.toString().