构建 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 特性概述:
特性 | none | system-icu | small-icu | full-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
--with-intl=full-icu
(default)
An overview of available Node.js and JavaScript features for each configure
option:
Feature | none | system-icu | small-icu | full-icu |
---|---|---|---|---|
String.prototype.normalize() | none (function is no-op) | full | full | full |
String.prototype.to*Case() | full | full | full | full |
Intl | none (object does not exist) | partial/full (depends on OS) | partial (English-only) | full |
String.prototype.localeCompare() | partial (not locale-aware) | full | full | full |
String.prototype.toLocale*Case() | partial (not locale-aware) | full | full | full |
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 Parser | partial (no IDN support) | full | full | full |
require('buffer').transcode() | none (function does not exist) | full | full | full |
REPL | partial (inaccurate line editing) | full | full | full |
require('util').TextDecoder | partial (basic encodings support) | partial/full (depends on OS) | partial (Unicode-only) | full |
RegExp Unicode Property Escapes | none (invalid RegExp error) | full | full | full |
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()
.