Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Unified Diff: src/extensions/experimental/i18n-extension.cc

Issue 6610006: Adding break iterator support to the i18n api extension.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/extensions/experimental/experimental.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/extensions/experimental/i18n-extension.cc
===================================================================
--- src/extensions/experimental/i18n-extension.cc (revision 7031)
+++ src/extensions/experimental/i18n-extension.cc (working copy)
@@ -30,6 +30,7 @@
#include <algorithm>
#include <string>
+#include "break-iterator.h"
#include "unicode/locid.h"
#include "unicode/uloc.h"
@@ -87,6 +88,23 @@
" var displayLocale = this.displayLocale_(optDisplayLocale);"
" native function NativeJSDisplayName();"
" return NativeJSDisplayName(this.locale, displayLocale);"
+ "};"
+ "v8Locale.v8BreakIterator = function(locale, type) {"
+ " native function NativeJSBreakIterator();"
+ " var iterator = NativeJSBreakIterator(locale, type);"
+ " iterator.type = type;"
+ " return iterator;"
+ "};"
+ "v8Locale.v8BreakIterator.BreakType = {"
+ " 'unknown': -1,"
+ " 'none': 0,"
+ " 'number': 100,"
+ " 'word': 200,"
+ " 'kana': 300,"
+ " 'ideo': 400"
+ "};"
+ "v8Locale.prototype.v8CreateBreakIterator = function(type) {"
+ " return new v8Locale.v8BreakIterator(this.locale, type);"
"};";
v8::Handle<v8::FunctionTemplate> I18NExtension::GetNativeFunction(
@@ -107,6 +125,8 @@
return v8::FunctionTemplate::New(JSDisplayRegion);
} else if (name->Equals(v8::String::New("NativeJSDisplayName"))) {
return v8::FunctionTemplate::New(JSDisplayName);
+ } else if (name->Equals(v8::String::New("NativeJSBreakIterator"))) {
+ return v8::FunctionTemplate::New(BreakIterator::JSBreakIterator);
}
return v8::Handle<v8::FunctionTemplate>();
« no previous file with comments | « src/extensions/experimental/experimental.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698