OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 I18NExtension::I18NExtension() | 50 I18NExtension::I18NExtension() |
51 : v8::Extension("v8/i18n", GetScriptSource()) { | 51 : v8::Extension("v8/i18n", GetScriptSource()) { |
52 } | 52 } |
53 | 53 |
54 v8::Handle<v8::FunctionTemplate> I18NExtension::GetNativeFunction( | 54 v8::Handle<v8::FunctionTemplate> I18NExtension::GetNativeFunction( |
55 v8::Handle<v8::String> name) { | 55 v8::Handle<v8::String> name) { |
56 if (name->Equals(v8::String::New("NativeJSLocale"))) { | 56 if (name->Equals(v8::String::New("NativeJSLocale"))) { |
57 return v8::FunctionTemplate::New(I18NLocale::JSLocale); | 57 return v8::FunctionTemplate::New(I18NLocale::JSLocale); |
| 58 } else if (name->Equals(v8::String::New("NativeJSAvailableLocales"))) { |
| 59 return v8::FunctionTemplate::New(I18NLocale::JSAvailableLocales); |
| 60 } else if (name->Equals(v8::String::New("NativeJSMaximizedLocale"))) { |
| 61 return v8::FunctionTemplate::New(I18NLocale::JSMaximizedLocale); |
| 62 } else if (name->Equals(v8::String::New("NativeJSMinimizedLocale"))) { |
| 63 return v8::FunctionTemplate::New(I18NLocale::JSMinimizedLocale); |
| 64 } else if (name->Equals(v8::String::New("NativeJSDisplayLanguage"))) { |
| 65 return v8::FunctionTemplate::New(I18NLocale::JSDisplayLanguage); |
| 66 } else if (name->Equals(v8::String::New("NativeJSDisplayScript"))) { |
| 67 return v8::FunctionTemplate::New(I18NLocale::JSDisplayScript); |
| 68 } else if (name->Equals(v8::String::New("NativeJSDisplayRegion"))) { |
| 69 return v8::FunctionTemplate::New(I18NLocale::JSDisplayRegion); |
| 70 } else if (name->Equals(v8::String::New("NativeJSDisplayName"))) { |
| 71 return v8::FunctionTemplate::New(I18NLocale::JSDisplayName); |
58 } else if (name->Equals(v8::String::New("NativeJSBreakIterator"))) { | 72 } else if (name->Equals(v8::String::New("NativeJSBreakIterator"))) { |
59 return v8::FunctionTemplate::New(BreakIterator::JSBreakIterator); | 73 return v8::FunctionTemplate::New(BreakIterator::JSBreakIterator); |
60 } else if (name->Equals(v8::String::New("NativeJSCollator"))) { | 74 } else if (name->Equals(v8::String::New("NativeJSCollator"))) { |
61 return v8::FunctionTemplate::New(Collator::JSCollator); | 75 return v8::FunctionTemplate::New(Collator::JSCollator); |
62 } | 76 } |
63 | 77 |
64 return v8::Handle<v8::FunctionTemplate>(); | 78 return v8::Handle<v8::FunctionTemplate>(); |
65 } | 79 } |
66 | 80 |
67 I18NExtension* I18NExtension::get() { | 81 I18NExtension* I18NExtension::get() { |
68 if (!extension_) { | 82 if (!extension_) { |
69 extension_ = new I18NExtension(); | 83 extension_ = new I18NExtension(); |
70 } | 84 } |
71 return extension_; | 85 return extension_; |
72 } | 86 } |
73 | 87 |
74 void I18NExtension::Register() { | 88 void I18NExtension::Register() { |
75 static v8::DeclareExtension i18n_extension_declaration(I18NExtension::get()); | 89 static v8::DeclareExtension i18n_extension_declaration(I18NExtension::get()); |
76 } | 90 } |
77 | 91 |
78 } } // namespace v8::internal | 92 } } // namespace v8::internal |
OLD | NEW |