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

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

Issue 6598014: 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
Index: src/extensions/experimental/i18n-extension.cc
===================================================================
--- src/extensions/experimental/i18n-extension.cc (revision 6955)
+++ 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,26 @@
" var displayLocale = this.displayLocale_(optDisplayLocale);"
" native function NativeJSDisplayName();"
" return NativeJSDisplayName(this.locale, displayLocale);"
+ "};"
+ "v8Locale.v8BreakIterator = function(locale, type) {"
Mads Ager (chromium) 2011/03/01 09:10:14 Do you need to have the v8 prefix on everything in
Nebojša Ćirić 2011/03/01 17:15:15 I'll rename v8Locale into LocaleInfo soon so we'll
+ " native function NativeJSBreakIterator();"
+ " if (locale === undefined || type === undefined) {"
+ " throw new Error('Locale and iterator type are required.');"
+ " }"
+ " 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 +128,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>();
« src/extensions/experimental/break-iterator.cc ('K') | « src/extensions/experimental/experimental.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698