| Index: src/extensions/experimental/i18n-extension.cc
|
| ===================================================================
|
| --- src/extensions/experimental/i18n-extension.cc (revision 7241)
|
| +++ src/extensions/experimental/i18n-extension.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2010 the V8 project authors. All rights reserved.
|
| +// Copyright 2011 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -31,6 +31,7 @@
|
| #include <string>
|
|
|
| #include "break-iterator.h"
|
| +#include "collator.h"
|
| #include "unicode/locid.h"
|
| #include "unicode/uloc.h"
|
|
|
| @@ -41,6 +42,8 @@
|
|
|
| // TODO(cira): maybe move JS code to a .js file and generata cc files from it?
|
| // TODO(cira): Remove v8 prefix from v8Locale once we have stable API.
|
| +// TODO(jungshik): Set |collator.options| to actually recognized / resolved
|
| +// options once |kSource| is build-time generated from an external file.
|
| const char* const I18NExtension::kSource =
|
| "v8Locale = function(optLocale) {"
|
| " native function NativeJSLocale();"
|
| @@ -105,6 +108,15 @@
|
| "};"
|
| "v8Locale.prototype.v8CreateBreakIterator = function(type) {"
|
| " return new v8Locale.v8BreakIterator(this.locale, type);"
|
| + "};"
|
| + "v8Locale.Collator = function(locale, options) {"
|
| + " native function NativeJSCollator();"
|
| + " var collator = NativeJSCollator(locale,"
|
| + " options === undefined ? {} : options);"
|
| + " return collator;"
|
| + "};"
|
| + "v8Locale.prototype.createCollator = function(options) {"
|
| + " return new v8Locale.Collator(this.locale, options);"
|
| "};";
|
|
|
| v8::Handle<v8::FunctionTemplate> I18NExtension::GetNativeFunction(
|
| @@ -127,6 +139,8 @@
|
| return v8::FunctionTemplate::New(JSDisplayName);
|
| } else if (name->Equals(v8::String::New("NativeJSBreakIterator"))) {
|
| return v8::FunctionTemplate::New(BreakIterator::JSBreakIterator);
|
| + } else if (name->Equals(v8::String::New("NativeJSCollator"))) {
|
| + return v8::FunctionTemplate::New(Collator::JSCollator);
|
| }
|
|
|
| return v8::Handle<v8::FunctionTemplate>();
|
|
|