Browse Source

src: add intl and icu configs to process.binding('config')

PR-URL: https://github.com/nodejs/node/pull/6266
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v6.x
James M Snell 9 years ago
parent
commit
86ff8447f3
  1. 14
      src/node_config.cc
  2. 4
      src/node_i18n.cc
  3. 3
      src/node_i18n.h

14
src/node_config.cc

@ -1,4 +1,5 @@
#include "node.h"
#include "node_i18n.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
@ -28,7 +29,18 @@ using v8::ReadOnly;
void InitConfig(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
// Environment* env = Environment::GetCurrent(context);
Environment* env = Environment::GetCurrent(context);
#ifdef NODE_HAVE_I18N_SUPPORT
READONLY_BOOLEAN_PROPERTY("hasIntl");
#ifdef NODE_HAVE_SMALL_ICU
READONLY_BOOLEAN_PROPERTY("hasSmallICU");
#endif // NODE_HAVE_SMALL_ICU
if (flag_icu_data_dir)
READONLY_BOOLEAN_PROPERTY("usingICUDataDir");
#endif // NODE_HAVE_I18N_SUPPORT
}
} // namespace node

4
src/node_i18n.cc

@ -42,10 +42,14 @@ extern "C" const char U_DATA_API SMALL_ICUDATA_ENTRY_POINT[];
#endif
namespace node {
bool flag_icu_data_dir = false;
namespace i18n {
bool InitializeICUDirectory(const char* icu_data_path) {
if (icu_data_path != nullptr) {
flag_icu_data_dir = true;
u_setDataDirectory(icu_data_path);
return true; // no error
} else {

3
src/node_i18n.h

@ -6,6 +6,9 @@
#if defined(NODE_HAVE_I18N_SUPPORT)
namespace node {
extern bool flag_icu_data_dir;
namespace i18n {
bool InitializeICUDirectory(const char* icu_data_path);

Loading…
Cancel
Save