6 files changed +15
-21
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ function setupConfig(_source) {
122
122
const oldV8BreakIterator = Intl . v8BreakIterator ;
123
123
const des = Object . getOwnPropertyDescriptor ( Intl , 'v8BreakIterator' ) ;
124
124
des . value = require ( 'internal/util' ) . deprecate ( function v8BreakIterator ( ) {
125
- if ( processConfig . hasSmallICU && ! process . icu_data_dir ) {
125
+ if ( processConfig . hasSmallICU && ! processConfig . icuDataDir ) {
126
126
// Intl.v8BreakIterator() would crash w/ fatal error, so throw instead.
127
127
throw new Error ( 'v8BreakIterator: full ICU data not installed. ' +
128
128
'See https://github.com/nodejs/node/wiki/Intl' ) ;
@@ -131,8 +131,6 @@ function setupConfig(_source) {
131
131
} , 'Intl.v8BreakIterator is deprecated and will be removed soon.' ) ;
132
132
Object . defineProperty ( Intl , 'v8BreakIterator' , des ) ;
133
133
}
134
- // Don’t let icu_data_dir leak through.
135
- delete process . icu_data_dir ;
136
134
}
137
135
138
136
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ static node_module* modlist_addon;
154
154
155
155
#if defined(NODE_HAVE_I18N_SUPPORT)
156
156
// Path to ICU data (for i18n / Intl)
157
- static std::string icu_data_dir; // NOLINT(runtime/string)
157
+ std::string icu_data_dir; // NOLINT(runtime/string)
158
158
#endif
159
159
160
160
// used by C++ modules as well
@@ -3067,17 +3067,6 @@ void SetupProcessObject(Environment* env,
3067
3067
" ares" ,
3068
3068
FIXED_ONE_BYTE_STRING (env->isolate (), ARES_VERSION_STR));
3069
3069
3070
- #if defined(NODE_HAVE_I18N_SUPPORT) && defined(U_ICU_VERSION)
3071
- // ICU-related versions are now handled on the js side, see bootstrap_node.js
3072
-
3073
- if (!icu_data_dir.empty ()) {
3074
- // Did the user attempt (via env var or parameter) to set an ICU path?
3075
- READONLY_PROPERTY (process,
3076
- " icu_data_dir" ,
3077
- OneByteString (env->isolate (), icu_data_dir.c_str ()));
3078
- }
3079
- #endif
3080
-
3081
3070
const char node_modules_version[] = NODE_STRINGIFY (NODE_MODULE_VERSION);
3082
3071
READONLY_PROPERTY (
3083
3072
versions,
Original file line number Diff line number Diff line change @@ -38,8 +38,11 @@ void InitConfig(Local<Object> target,
38
38
READONLY_BOOLEAN_PROPERTY (" hasSmallICU" );
39
39
#endif // NODE_HAVE_SMALL_ICU
40
40
41
- if (flag_icu_data_dir)
42
- READONLY_BOOLEAN_PROPERTY (" usingICUDataDir" );
41
+ target->DefineOwnProperty (env->context (),
42
+ OneByteString (env->isolate (), " icuDataDir" ),
43
+ OneByteString (env->isolate (), icu_data_dir.data ()))
44
+ .FromJust ();
45
+
43
46
#endif // NODE_HAVE_I18N_SUPPORT
44
47
45
48
if (config_preserve_symlinks)
Original file line number Diff line number Diff line change @@ -70,8 +70,6 @@ using v8::Object;
70
70
using v8::String;
71
71
using v8::Value;
72
72
73
- bool flag_icu_data_dir = false ;
74
-
75
73
namespace i18n {
76
74
77
75
const size_t kStorageSize = 1024 ;
@@ -415,7 +413,6 @@ bool InitializeICUDirectory(const std::string& path) {
415
413
#endif // !NODE_HAVE_SMALL_ICU
416
414
return (status == U_ZERO_ERROR);
417
415
} else {
418
- flag_icu_data_dir = true ;
419
416
u_setDataDirectory (path.c_str ());
420
417
return true ; // No error.
421
418
}
Original file line number Diff line number Diff line change 10
10
11
11
namespace node {
12
12
13
- extern bool flag_icu_data_dir;
13
+ extern std::string icu_data_dir; // NOLINT(runtime/string)
14
14
15
15
namespace i18n {
16
16
Original file line number Diff line number Diff line change
1
+ // Flags: --icu-data-dir=test/fixtures/empty/
2
+ 'use strict' ;
3
+ require ( '../common' ) ;
4
+ const assert = require ( 'assert' ) ;
5
+
6
+ // No-op when ICU case mappings are unavailable.
7
+ assert . strictEqual ( 'ç' . toLocaleUpperCase ( 'el' ) , 'ç' ) ;
0 commit comments