mirror of https://github.com/nodejs/node.git
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>pull/6266/merge
parent
2e974cdd8c
commit
cdba9a6c02
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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…
Reference in New Issue