Skip to content

Commit

Permalink
src: add intl and icu configs to process.binding('config')
Browse files Browse the repository at this point in the history
PR-URL: #6266
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
jasnell committed Apr 26, 2016
1 parent 5b7a011 commit 86ff844
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/node_config.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "node.h"
#include "node_i18n.h"
#include "env.h"
#include "env-inl.h"
#include "util.h"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/node_i18n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/node_i18n.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 86ff844

Please sign in to comment.