构建 Node.js 的选项


为了控制在 Node.js 中如何使用 ICU,在编译期间提供了四个 configure 选项。 BUILDING.md 中记录了有关如何编译 Node.js 的其他详细信息。

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

每个 configure 选项的可用 Node.js 和 JavaScript 特性概述:

nonesystem-icusmall-icufull-icu
String.prototype.normalize()无(函数无操作)完整完整完整
String.prototype.to*Case()完整完整完整完整
Intl无(对象不存在)部分/完整(取决于操作系统)部分(仅英文)完整
String.prototype.localeCompare()部分(不识别区域设置)完整完整完整
String.prototype.toLocale*Case()部分(不识别区域设置)完整完整完整
Number.prototype.toLocaleString()部分(不识别区域设置)部分/完整(取决于操作系统)部分(仅英文)完整
Date.prototype.toLocale*String()部分(不识别区域设置)部分/完整(取决于操作系统)部分(仅英文)完整
WHATWG URL Parser部分(不支持 IDN)完整完整完整
require('buffer').transcode()无(函数不存在)完整完整完整
REPL部分(不准确的行编辑)完整完整完整
require('util').TextDecoder部分(基本的编码支持)部分/完整(取决于操作系统)部分(仅限 Unicode)完整
RegExp Unicode Property Escapes无(无效的 RegExp 错误)完整完整完整

"(not locale-aware)" 表示该函数执行其操作就像函数的非 Locale 版本一样,如果存在的话。 比如在 none 模式下,Date.prototype.toLocaleString() 的操作和 Date.prototype.toString() 是一样的。

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 (default)
  • --with-intl=full-icu

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

nonesystem-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
WHATWG URL Parserpartial (no IDN support)fullfullfull
require('buffer').transcode()none (function does not exist)fullfullfull
REPLpartial (inaccurate line editing)fullfullfull
require('util').TextDecoderpartial (basic encodings support)partial/full (depends on OS)partial (Unicode-only)full
RegExp Unicode Property Escapesnone (invalid RegExp error)fullfullfull

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().