@@ -113,27 +113,47 @@ This mode provides a balance between features and binary size.
113
113
114
114
If the ` small-icu ` option is used, one can still provide additional locale data
115
115
at runtime so that the JS methods would work for all ICU locales. Assuming the
116
- data file is stored at ` /some/directory ` , it can be made available to ICU
117
- through either:
116
+ data file is stored at ` /runtime/directory/with/dat/file ` , it can be made
117
+ available to ICU through either:
118
+
119
+ * The ` --with-icu-default-data-dir ` configure option:
120
+
121
+ ``` bash
122
+ ./configure --with-icu-default-data-dir=/runtime/directory/with/dat/file --with-intl=small-icu
123
+ ```
124
+
125
+ This only embeds the default data directory path into the binary.
126
+ The actual data file is going to be loaded at runtime from this directory
127
+ path.
118
128
119
129
* The [ ` NODE_ICU_DATA ` ] [ ] environment variable:
120
130
121
131
``` bash
122
- env NODE_ICU_DATA=/some /directory node
132
+ env NODE_ICU_DATA=/runtime /directory/with/dat/file node
123
133
```
124
134
125
135
* The [ ` --icu-data-dir ` ] [ ] CLI parameter:
126
136
127
137
``` bash
128
- node --icu-data-dir=/some /directory
138
+ node --icu-data-dir=/runtime /directory/with/dat/file
129
139
```
130
140
131
- (If both are specified, the ` --icu-data-dir ` CLI parameter takes precedence.)
141
+ When more than one of them is specified, the ` --icu-data-dir ` CLI parameter has
142
+ the highest precedence, then the ` NODE_ICU_DATA ` environment variable, then
143
+ the ` --with-icu-default-data-dir ` configure option.
132
144
133
145
ICU is able to automatically find and load a variety of data formats, but the
134
146
data must be appropriate for the ICU version, and the file correctly named.
135
- The most common name for the data file is ` icudt6X [bl].dat` , where ` 6X ` denotes
147
+ The most common name for the data file is ` icudtX [bl].dat` , where ` X ` denotes
136
148
the intended ICU version, and ` b ` or ` l ` indicates the system's endianness.
149
+ Node.js would fail to load if the expected data file cannot be read from the
150
+ specified directory. The name of the data file corresponding to the current
151
+ Node.js version can be computed with:
152
+
153
+ ``` js
154
+ ` icudt${ process .versions .icu .split (' .' )[0 ]}${ os .endianness ()[0 ].toLowerCase ()} .dat` ;
155
+ ```
156
+
137
157
Check [ "ICU Data"] [ ] article in the ICU User Guide for other supported formats
138
158
and more details on ICU data in general.
139
159
0 commit comments