22#include  " memory_tracker.h" 
33#include  " node.h" 
44#include  " node_builtins.h" 
5+ #include  " node_external_reference.h" 
56#include  " node_i18n.h" 
67#include  " node_options.h" 
78#include  " util-inl.h" 
89
910namespace  node  {
1011
1112using  v8::Context;
13+ using  v8::FunctionCallbackInfo;
1214using  v8::Isolate;
1315using  v8::Local;
1416using  v8::Number;
1517using  v8::Object;
18+ using  v8::String;
1619using  v8::Value;
1720
21+ void  GetDefaultLocale (const  FunctionCallbackInfo<Value>& args) {
22+   Isolate* isolate = args.GetIsolate ();
23+   Local<Context> context = isolate->GetCurrentContext ();
24+   std::string locale = isolate->GetDefaultLocale ();
25+   Local<Value> result;
26+   if  (ToV8Value (context, locale).ToLocal (&result)) {
27+     args.GetReturnValue ().Set (result);
28+   }
29+ }
30+ 
1831//  The config binding is used to provide an internal view of compile time
1932//  config options that are required internally by lib/*.js code. This is an
2033//  alternative to dropping additional properties onto the process object as
@@ -23,7 +36,7 @@ using v8::Value;
2336//  Command line arguments are already accessible in the JS land via
2437//  require('internal/options').getOptionValue('--some-option'). Do not add them
2538//  here.
26- static  void  Initialize (Local<Object> target,
39+ static  void  InitConfig (Local<Object> target,
2740                       Local<Value> unused,
2841                       Local<Context> context,
2942                       void * priv) {
@@ -76,8 +89,15 @@ static void Initialize(Local<Object> target,
7689#endif   //  NODE_NO_BROWSER_GLOBALS
7790
7891  READONLY_PROPERTY (target, " bits" Number::New (isolate, 8  * sizeof (intptr_t )));
92+ 
93+   SetMethodNoSideEffect (context, target, " getDefaultLocale" 
7994}  //  InitConfig
8095
96+ void  RegisterConfigExternalReferences (ExternalReferenceRegistry* registry) {
97+   registry->Register (GetDefaultLocale);
98+ }
99+ 
81100}  //  namespace node
82101
83- NODE_BINDING_CONTEXT_AWARE_INTERNAL (config, node::Initialize)
102+ NODE_BINDING_CONTEXT_AWARE_INTERNAL (config, node::InitConfig)
103+ NODE_BINDING_EXTERNAL_REFERENCE(config, node::RegisterConfigExternalReferences)
0 commit comments