Linux web-conference.aiou.edu.pk 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64
Apache/2.4.41 (Ubuntu)
: 172.16.50.247 | : 18.217.14.237
Cant Read [ /etc/named.conf ]
7.4.3-4ubuntu2.28
appadmin
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
nodejs-doc /
api /
[ HOME SHELL ]
Name
Size
Permission
Action
assets
[ DIR ]
drwxr-xr-x
addons.html
53.67
KB
-rw-r--r--
addons.md.gz
9.8
KB
-rw-r--r--
all.html
3.13
MB
-rw-r--r--
assert.html
69.81
KB
-rw-r--r--
assert.md.gz
8.17
KB
-rw-r--r--
async_hooks.html
45.55
KB
-rw-r--r--
async_hooks.md.gz
8.19
KB
-rw-r--r--
buffer.html
157.61
KB
-rw-r--r--
buffer.md.gz
16.99
KB
-rw-r--r--
child_process.html
111.13
KB
-rw-r--r--
child_process.md.gz
13.71
KB
-rw-r--r--
cli.html
47.44
KB
-rw-r--r--
cli.md.gz
7.5
KB
-rw-r--r--
cluster.html
46.91
KB
-rw-r--r--
cluster.md.gz
7.48
KB
-rw-r--r--
console.html
38.66
KB
-rw-r--r--
console.md.gz
4.73
KB
-rw-r--r--
crypto.html
212.4
KB
-rw-r--r--
crypto.md.gz
20.62
KB
-rw-r--r--
debugger.html
15.25
KB
-rw-r--r--
debugger.md.gz
2.33
KB
-rw-r--r--
deprecations.html
101.97
KB
-rw-r--r--
deprecations.md.gz
11.03
KB
-rw-r--r--
dgram.html
46.05
KB
-rw-r--r--
dgram.md.gz
6.51
KB
-rw-r--r--
dns.html
86.31
KB
-rw-r--r--
dns.md.gz
8.27
KB
-rw-r--r--
documentation.html
11.69
KB
-rw-r--r--
documentation.md
3.66
KB
-rw-r--r--
domain.html
27.43
KB
-rw-r--r--
domain.md.gz
5.45
KB
-rw-r--r--
errors.html
164.88
KB
-rw-r--r--
errors.md.gz
20.08
KB
-rw-r--r--
esm.html
17.08
KB
-rw-r--r--
esm.md.gz
2.82
KB
-rw-r--r--
events.html
43.87
KB
-rw-r--r--
events.md.gz
5.46
KB
-rw-r--r--
fs.html
330.85
KB
-rw-r--r--
fs.md.gz
28.03
KB
-rw-r--r--
globals.html
15.24
KB
-rw-r--r--
globals.md.gz
1.24
KB
-rw-r--r--
http.html
124.8
KB
-rw-r--r--
http.md.gz
17.74
KB
-rw-r--r--
http2.html
209.44
KB
-rw-r--r--
http2.md.gz
25.84
KB
-rw-r--r--
https.html
26.25
KB
-rw-r--r--
https.md.gz
3.5
KB
-rw-r--r--
index.html
8.81
KB
-rw-r--r--
index.md
1.57
KB
-rw-r--r--
inspector.html
17.34
KB
-rw-r--r--
inspector.md.gz
2.23
KB
-rw-r--r--
intl.html
20.58
KB
-rw-r--r--
intl.md.gz
3.53
KB
-rw-r--r--
modules.html
48.55
KB
-rw-r--r--
modules.md.gz
9.04
KB
-rw-r--r--
n-api.html
247.99
KB
-rw-r--r--
n-api.md.gz
32.48
KB
-rw-r--r--
net.html
82.9
KB
-rw-r--r--
net.md.gz
9.86
KB
-rw-r--r--
os.html
53.19
KB
-rw-r--r--
os.md.gz
7.37
KB
-rw-r--r--
path.html
32.74
KB
-rw-r--r--
path.md.gz
3.75
KB
-rw-r--r--
perf_hooks.html
31.93
KB
-rw-r--r--
perf_hooks.md.gz
3.18
KB
-rw-r--r--
process.html
118.78
KB
-rw-r--r--
process.md.gz
19.76
KB
-rw-r--r--
punycode.html
14.66
KB
-rw-r--r--
punycode.md.gz
1.46
KB
-rw-r--r--
querystring.html
16.92
KB
-rw-r--r--
querystring.md.gz
1.79
KB
-rw-r--r--
readline.html
39.12
KB
-rw-r--r--
readline.md.gz
5.64
KB
-rw-r--r--
repl.html
38.59
KB
-rw-r--r--
repl.md.gz
6.95
KB
-rw-r--r--
stream.html
150.27
KB
-rw-r--r--
stream.md.gz
23.02
KB
-rw-r--r--
string_decoder.html
12.16
KB
-rw-r--r--
string_decoder.md
2.75
KB
-rw-r--r--
synopsis.html
9.93
KB
-rw-r--r--
synopsis.md
2.69
KB
-rw-r--r--
timers.html
22.62
KB
-rw-r--r--
timers.md.gz
2.48
KB
-rw-r--r--
tls.html
106.34
KB
-rw-r--r--
tls.md.gz
17.93
KB
-rw-r--r--
tracing.html
16.44
KB
-rw-r--r--
tracing.md.gz
2.03
KB
-rw-r--r--
tty.html
20.34
KB
-rw-r--r--
tty.md.gz
2.39
KB
-rw-r--r--
url.html
76.68
KB
-rw-r--r--
url.md.gz
10.63
KB
-rw-r--r--
util.html
128.5
KB
-rw-r--r--
util.md.gz
13.97
KB
-rw-r--r--
v8.html
33.74
KB
-rw-r--r--
v8.md.gz
3.86
KB
-rw-r--r--
vm.html
72.43
KB
-rw-r--r--
vm.md.gz
9.85
KB
-rw-r--r--
worker_threads.html
35.04
KB
-rw-r--r--
worker_threads.md.gz
5.06
KB
-rw-r--r--
zlib.html
74.5
KB
-rw-r--r--
zlib.md.gz
7.2
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : intl.html
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Internationalization Support | Node.js v10.19.0 Documentation</title> <link rel="stylesheet" href="assets/style.css"> <link rel="stylesheet" href="assets/sh.css"> <link rel="canonical" href="intl.html"> </head> <body class="alt apidoc" id="api-section-intl"> <div id="content" class="clearfix"> <div id="column2" class="interior"> <div id="intro" class="interior"> <a href="/" title="Go back to the home page"> Node.js </a> </div> <ul> <li><a class="nav-documentation" href="documentation.html">About these Docs</a></li> <li><a class="nav-synopsis" href="synopsis.html">Usage & Example</a></li> </ul> <div class="line"></div> <ul> <li><a class="nav-assert" href="assert.html">Assertion Testing</a></li> <li><a class="nav-async_hooks" href="async_hooks.html">Async Hooks</a></li> <li><a class="nav-buffer" href="buffer.html">Buffer</a></li> <li><a class="nav-addons" href="addons.html">C++ Addons</a></li> <li><a class="nav-n-api" href="n-api.html">C/C++ Addons - N-API</a></li> <li><a class="nav-child_process" href="child_process.html">Child Processes</a></li> <li><a class="nav-cluster" href="cluster.html">Cluster</a></li> <li><a class="nav-cli" href="cli.html">Command Line Options</a></li> <li><a class="nav-console" href="console.html">Console</a></li> <li><a class="nav-crypto" href="crypto.html">Crypto</a></li> <li><a class="nav-debugger" href="debugger.html">Debugger</a></li> <li><a class="nav-deprecations" href="deprecations.html">Deprecated APIs</a></li> <li><a class="nav-dns" href="dns.html">DNS</a></li> <li><a class="nav-domain" href="domain.html">Domain</a></li> <li><a class="nav-esm" href="esm.html">ECMAScript Modules</a></li> <li><a class="nav-errors" href="errors.html">Errors</a></li> <li><a class="nav-events" href="events.html">Events</a></li> <li><a class="nav-fs" href="fs.html">File System</a></li> <li><a class="nav-globals" href="globals.html">Globals</a></li> <li><a class="nav-http" href="http.html">HTTP</a></li> <li><a class="nav-http2" href="http2.html">HTTP/2</a></li> <li><a class="nav-https" href="https.html">HTTPS</a></li> <li><a class="nav-inspector" href="inspector.html">Inspector</a></li> <li><a class="nav-intl active" href="intl.html">Internationalization</a></li> <li><a class="nav-modules" href="modules.html">Modules</a></li> <li><a class="nav-net" href="net.html">Net</a></li> <li><a class="nav-os" href="os.html">OS</a></li> <li><a class="nav-path" href="path.html">Path</a></li> <li><a class="nav-perf_hooks" href="perf_hooks.html">Performance Hooks</a></li> <li><a class="nav-process" href="process.html">Process</a></li> <li><a class="nav-punycode" href="punycode.html">Punycode</a></li> <li><a class="nav-querystring" href="querystring.html">Query Strings</a></li> <li><a class="nav-readline" href="readline.html">Readline</a></li> <li><a class="nav-repl" href="repl.html">REPL</a></li> <li><a class="nav-stream" href="stream.html">Stream</a></li> <li><a class="nav-string_decoder" href="string_decoder.html">String Decoder</a></li> <li><a class="nav-timers" href="timers.html">Timers</a></li> <li><a class="nav-tls" href="tls.html">TLS/SSL</a></li> <li><a class="nav-tracing" href="tracing.html">Trace Events</a></li> <li><a class="nav-tty" href="tty.html">TTY</a></li> <li><a class="nav-dgram" href="dgram.html">UDP/Datagram</a></li> <li><a class="nav-url" href="url.html">URL</a></li> <li><a class="nav-util" href="util.html">Utilities</a></li> <li><a class="nav-v8" href="v8.html">V8</a></li> <li><a class="nav-vm" href="vm.html">VM</a></li> <li><a class="nav-worker_threads" href="worker_threads.html">Worker Threads</a></li> <li><a class="nav-zlib" href="zlib.html">Zlib</a></li> </ul> <div class="line"></div> <ul> <li><a class="nav-https-github-com-nodejs-node" href="https://github.com/nodejs/node">GitHub Repo & Issue Tracker</a></li> </ul> </div> <div id="column1" data-id="intl" class="interior"> <header> <h1>Node.js v10.19.0 Documentation</h1> <div id="gtoc"> <ul> <li> <a href="index.html" name="toc">Index</a> </li> <li> <a href="all.html">View on single page</a> </li> <li> <a href="intl.json">View as JSON</a> </li> <li class="version-picker"> <a href="#">View another version <span>▼</span></a> <ol class="version-picker"><li><a href="https://nodejs.org/docs/latest-v12.x/api/intl.html">12.x</a></li> <li><a href="https://nodejs.org/docs/latest-v11.x/api/intl.html">11.x</a></li> <li><a href="https://nodejs.org/docs/latest-v10.x/api/intl.html">10.x <b>LTS</b></a></li> <li><a href="https://nodejs.org/docs/latest-v9.x/api/intl.html">9.x</a></li> <li><a href="https://nodejs.org/docs/latest-v8.x/api/intl.html">8.x <b>LTS</b></a></li></ol> </li> <li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/master/doc/api/intl.md"><span class="github_icon"><svg height="16" width="16" viewBox="0 0 16.1 16.1" fill="currentColor"><path d="M8 0a8 8 0 0 0-2.5 15.6c.4 0 .5-.2.5-.4v-1.5c-2 .4-2.5-.5-2.7-1 0-.1-.5-.9-.8-1-.3-.2-.7-.6 0-.6.6 0 1 .6 1.2.8.7 1.2 1.9 1 2.4.7 0-.5.2-.9.5-1-1.8-.3-3.7-1-3.7-4 0-.9.3-1.6.8-2.2 0-.2-.3-1 .1-2 0 0 .7-.3 2.2.7a7.4 7.4 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.5 1.1.2 2 .1 2.1.5.6.8 1.3.8 2.2 0 3-1.9 3.7-3.6 4 .3.2.5.7.5 1.4v2.2c0 .2.1.5.5.4A8 8 0 0 0 16 8a8 8 0 0 0-8-8z"/></svg></span>Edit on GitHub</a></li> </ul> </div> <hr> </header> <div id="toc"> <h2>Table of Contents</h2> <ul> <li><a href="#intl_internationalization_support">Internationalization Support</a><ul> <li><a href="#intl_options_for_building_node_js">Options for building Node.js</a><ul> <li><a href="#intl_disable_all_internationalization_features_none">Disable all internationalization features (<code>none</code>)</a></li> <li><a href="#intl_build_with_a_pre_installed_icu_system_icu">Build with a pre-installed ICU (<code>system-icu</code>)</a></li> <li><a href="#intl_embed_a_limited_set_of_icu_data_small_icu">Embed a limited set of ICU data (<code>small-icu</code>)</a><ul> <li><a href="#intl_providing_icu_data_at_runtime">Providing ICU data at runtime</a></li> </ul> </li> <li><a href="#intl_embed_the_entire_icu_full_icu">Embed the entire ICU (<code>full-icu</code>)</a></li> </ul> </li> <li><a href="#intl_detecting_internationalization_support">Detecting internationalization support</a></li> </ul> </li> </ul> </div> <div id="apicontent"> <h1>Internationalization Support<span><a class="mark" href="#intl_internationalization_support" id="intl_internationalization_support">#</a></span></h1> <!--introduced_in=v8.2.0--> <!-- type=misc --> <p>Node.js has many features that make it easier to write internationalized programs. Some of them are:</p> <ul> <li>Locale-sensitive or Unicode-aware functions in the <a href="https://tc39.github.io/ecma262/">ECMAScript Language Specification</a>:<ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize"><code>String.prototype.normalize()</code></a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase"><code>String.prototype.toLowerCase()</code></a></li> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase"><code>String.prototype.toUpperCase()</code></a></li> </ul> </li> <li>All functionality described in the <a href="https://tc39.github.io/ecma402/">ECMAScript Internationalization API Specification</a> (aka ECMA-402):<ul> <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl"><code>Intl</code></a> object</li> <li>Locale-sensitive methods like <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare"><code>String.prototype.localeCompare()</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString"><code>Date.prototype.toLocaleString()</code></a></li> </ul> </li> <li>The <a href="url.html#url_the_whatwg_url_api">WHATWG URL parser</a>'s <a href="https://en.wikipedia.org/wiki/Internationalized_domain_name">internationalized domain names</a> (IDNs) support</li> <li><a href="buffer.html#buffer_buffer_transcode_source_fromenc_toenc"><code>require('buffer').transcode()</code></a></li> <li>More accurate <a href="repl.html#repl_repl">REPL</a> line editing</li> <li><a href="util.html#util_class_util_textdecoder"><code>require('util').TextDecoder</code></a></li> <li><a href="https://github.com/tc39/proposal-regexp-unicode-property-escapes"><code>RegExp</code> Unicode Property Escapes</a></li> </ul> <p>Node.js (and its underlying V8 engine) uses <a href="http://site.icu-project.org/">ICU</a> to implement these features in native C/C++ code. However, some of them require a very large ICU data file in order to support all locales of the world. Because it is expected that most Node.js users will make use of only a small portion of ICU functionality, only a subset of the full ICU data set is provided by Node.js by default. Several options are provided for customizing and expanding the ICU data set either when building or running Node.js.</p> <h2>Options for building Node.js<span><a class="mark" href="#intl_options_for_building_node_js" id="intl_options_for_building_node_js">#</a></span></h2> <p>To control how ICU is used in Node.js, four <code>configure</code> options are available during compilation. Additional details on how to compile Node.js are documented in <a href="https://github.com/nodejs/node/blob/master/BUILDING.md">BUILDING.md</a>.</p> <ul> <li><code>--with-intl=none</code>/<code>--without-intl</code></li> <li><code>--with-intl=system-icu</code></li> <li><code>--with-intl=small-icu</code> (default)</li> <li><code>--with-intl=full-icu</code></li> </ul> <p>An overview of available Node.js and JavaScript features for each <code>configure</code> option:</p> <table> <thead> <tr> <th></th> <th><code>none</code></th> <th><code>system-icu</code></th> <th><code>small-icu</code></th> <th><code>full-icu</code></th> </tr> </thead> <tbody><tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize"><code>String.prototype.normalize()</code></a></td> <td>none (function is no-op)</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><code>String.prototype.to*Case()</code></td> <td>full</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl"><code>Intl</code></a></td> <td>none (object does not exist)</td> <td>partial/full (depends on OS)</td> <td>partial (English-only)</td> <td>full</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare"><code>String.prototype.localeCompare()</code></a></td> <td>partial (not locale-aware)</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><code>String.prototype.toLocale*Case()</code></td> <td>partial (not locale-aware)</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString"><code>Number.prototype.toLocaleString()</code></a></td> <td>partial (not locale-aware)</td> <td>partial/full (depends on OS)</td> <td>partial (English-only)</td> <td>full</td> </tr> <tr> <td><code>Date.prototype.toLocale*String()</code></td> <td>partial (not locale-aware)</td> <td>partial/full (depends on OS)</td> <td>partial (English-only)</td> <td>full</td> </tr> <tr> <td><a href="url.html#url_the_whatwg_url_api">WHATWG URL Parser</a></td> <td>partial (no IDN support)</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><a href="buffer.html#buffer_buffer_transcode_source_fromenc_toenc"><code>require('buffer').transcode()</code></a></td> <td>none (function does not exist)</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><a href="repl.html#repl_repl">REPL</a></td> <td>partial (inaccurate line editing)</td> <td>full</td> <td>full</td> <td>full</td> </tr> <tr> <td><a href="util.html#util_class_util_textdecoder"><code>require('util').TextDecoder</code></a></td> <td>partial (basic encodings support)</td> <td>partial/full (depends on OS)</td> <td>partial (Unicode-only)</td> <td>full</td> </tr> <tr> <td><a href="https://github.com/tc39/proposal-regexp-unicode-property-escapes"><code>RegExp</code> Unicode Property Escapes</a></td> <td>none (invalid <code>RegExp</code> error)</td> <td>full</td> <td>full</td> <td>full</td> </tr> </tbody></table> <p>The "(not locale-aware)" designation denotes that the function carries out its operation just like the non-<code>Locale</code> version of the function, if one exists. For example, under <code>none</code> mode, <code>Date.prototype.toLocaleString()</code>'s operation is identical to that of <code>Date.prototype.toString()</code>.</p> <h3>Disable all internationalization features (<code>none</code>)<span><a class="mark" href="#intl_disable_all_internationalization_features_none" id="intl_disable_all_internationalization_features_none">#</a></span></h3> <p>If this option is chosen, most internationalization features mentioned above will be <strong>unavailable</strong> in the resulting <code>node</code> binary.</p> <h3>Build with a pre-installed ICU (<code>system-icu</code>)<span><a class="mark" href="#intl_build_with_a_pre_installed_icu_system_icu" id="intl_build_with_a_pre_installed_icu_system_icu">#</a></span></h3> <p>Node.js can link against an ICU build already installed on the system. In fact, most Linux distributions already come with ICU installed, and this option would make it possible to reuse the same set of data used by other components in the OS.</p> <p>Functionalities that only require the ICU library itself, such as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize"><code>String.prototype.normalize()</code></a> and the <a href="url.html#url_the_whatwg_url_api">WHATWG URL parser</a>, are fully supported under <code>system-icu</code>. Features that require ICU locale data in addition, such as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat"><code>Intl.DateTimeFormat</code></a> <em>may</em> be fully or partially supported, depending on the completeness of the ICU data installed on the system.</p> <h3>Embed a limited set of ICU data (<code>small-icu</code>)<span><a class="mark" href="#intl_embed_a_limited_set_of_icu_data_small_icu" id="intl_embed_a_limited_set_of_icu_data_small_icu">#</a></span></h3> <p>This option makes the resulting binary link against the ICU library statically, and includes a subset of ICU data (typically only the English locale) within the <code>node</code> executable.</p> <p>Functionalities that only require the ICU library itself, such as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize"><code>String.prototype.normalize()</code></a> and the <a href="url.html#url_the_whatwg_url_api">WHATWG URL parser</a>, are fully supported under <code>small-icu</code>. Features that require ICU locale data in addition, such as <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat"><code>Intl.DateTimeFormat</code></a>, generally only work with the English locale:</p> <pre><code class="language-js">const january = new Date(9e8); const english = new Intl.DateTimeFormat('en', { month: 'long' }); const spanish = new Intl.DateTimeFormat('es', { month: 'long' }); console.log(english.format(january)); // Prints "January" console.log(spanish.format(january)); // Prints "M01" on small-icu // Should print "enero"</code></pre> <p>This mode provides a good balance between features and binary size, and it is the default behavior if no <code>--with-intl</code> flag is passed. The official binaries are also built in this mode.</p> <h4>Providing ICU data at runtime<span><a class="mark" href="#intl_providing_icu_data_at_runtime" id="intl_providing_icu_data_at_runtime">#</a></span></h4> <p>If the <code>small-icu</code> option is used, one can still provide additional locale data at runtime so that the JS methods would work for all ICU locales. Assuming the data file is stored at <code>/some/directory</code>, it can be made available to ICU through either:</p> <ul> <li><p>The <a href="cli.html#cli_node_icu_data_file"><code>NODE_ICU_DATA</code></a> environment variable:</p> <pre><code class="language-shell">env NODE_ICU_DATA=/some/directory node</code></pre> </li> <li><p>The <a href="cli.html#cli_icu_data_dir_file"><code>--icu-data-dir</code></a> CLI parameter:</p> <pre><code class="language-shell">node --icu-data-dir=/some/directory</code></pre> </li> </ul> <p>(If both are specified, the <code>--icu-data-dir</code> CLI parameter takes precedence.)</p> <p>ICU is able to automatically find and load a variety of data formats, but the data must be appropriate for the ICU version, and the file correctly named. The most common name for the data file is <code>icudt6X[bl].dat</code>, where <code>6X</code> denotes the intended ICU version, and <code>b</code> or <code>l</code> indicates the system's endianness. Check <a href="http://userguide.icu-project.org/icudata">"ICU Data"</a> article in the ICU User Guide for other supported formats and more details on ICU data in general.</p> <p>The <a href="https://www.npmjs.com/package/full-icu">full-icu</a> npm module can greatly simplify ICU data installation by detecting the ICU version of the running <code>node</code> executable and downloading the appropriate data file. After installing the module through <code>npm i full-icu</code>, the data file will be available at <code>./node_modules/full-icu</code>. This path can be then passed either to <code>NODE_ICU_DATA</code> or <code>--icu-data-dir</code> as shown above to enable full <code>Intl</code> support.</p> <h3>Embed the entire ICU (<code>full-icu</code>)<span><a class="mark" href="#intl_embed_the_entire_icu_full_icu" id="intl_embed_the_entire_icu_full_icu">#</a></span></h3> <p>This option makes the resulting binary link against ICU statically and include a full set of ICU data. A binary created this way has no further external dependencies and supports all locales, but might be rather large. See <a href="https://github.com/nodejs/node/blob/master/BUILDING.md#build-with-full-icu-support-all-locales-supported-by-icu">BUILDING.md</a> on how to compile a binary using this mode.</p> <h2>Detecting internationalization support<span><a class="mark" href="#intl_detecting_internationalization_support" id="intl_detecting_internationalization_support">#</a></span></h2> <p>To verify that ICU is enabled at all (<code>system-icu</code>, <code>small-icu</code>, or <code>full-icu</code>), simply checking the existence of <code>Intl</code> should suffice:</p> <pre><code class="language-js">const hasICU = typeof Intl === 'object';</code></pre> <p>Alternatively, checking for <code>process.versions.icu</code>, a property defined only when ICU is enabled, works too:</p> <pre><code class="language-js">const hasICU = typeof process.versions.icu === 'string';</code></pre> <p>To check for support for a non-English locale (i.e. <code>full-icu</code> or <code>system-icu</code>), <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat"><code>Intl.DateTimeFormat</code></a> can be a good distinguishing factor:</p> <pre><code class="language-js">const hasFullICU = (() => { try { const january = new Date(9e8); const spanish = new Intl.DateTimeFormat('es', { month: 'long' }); return spanish.format(january) === 'enero'; } catch (err) { return false; } })();</code></pre> <p>For more verbose tests for <code>Intl</code> support, the following resources may be found to be helpful:</p> <ul> <li><a href="https://github.com/srl295/btest402">btest402</a>: Generally used to check whether Node.js with <code>Intl</code> support is built correctly.</li> <li><a href="https://github.com/tc39/test262/tree/master/test/intl402">Test262</a>: ECMAScript's official conformance test suite includes a section dedicated to ECMA-402.</li> </ul> </div> </div> </div> <script src="assets/sh_main.js"></script> <script src="assets/sh_javascript.min.js"></script> <script>highlight(undefined, undefined, 'pre');</script> </body> </html>
Close