OLD | NEW |
---|---|
1 // Copyright 2006-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 // values. | 112 // values. |
113 /** | 113 /** |
114 * Collator class implements locale-aware sort. | 114 * Collator class implements locale-aware sort. |
115 * @param {Object} locale - locale object to pass to collator implementation. | 115 * @param {Object} locale - locale object to pass to collator implementation. |
116 * @param {Object} settings - collation flags: | 116 * @param {Object} settings - collation flags: |
117 * - ignoreCase | 117 * - ignoreCase |
118 * - ignoreAccents | 118 * - ignoreAccents |
119 * - numeric | 119 * - numeric |
120 * @constructor | 120 * @constructor |
121 */ | 121 */ |
122 v8Locale.Collator = function(locale, settings) { | 122 v8Locale.__Collator = function(locale, settings) { |
123 native function NativeJSCollator(); | 123 native function NativeJSCollator(); |
124 | 124 |
125 locale = v8Locale.__createLocaleOrDefault(locale); | 125 locale = v8Locale.__createLocaleOrDefault(locale); |
126 var collator = NativeJSCollator( | 126 var collator = NativeJSCollator( |
127 locale.__icuLocaleID, v8Locale.__createSettingsOrDefault(settings, {})); | 127 locale.__icuLocaleID, v8Locale.__createSettingsOrDefault(settings, {})); |
128 return collator; | 128 return collator; |
Nebojša Ćirić
2011/05/20 16:46:57
Do you want to add derive method here, and return
| |
129 }; | 129 }; |
130 | 130 |
131 /** | 131 /** |
132 * Creates new Collator based on current locale. | 132 * Creates new Collator based on current locale. |
133 * @param {Object} - collation flags. See constructor. | 133 * @param {Object} - collation flags. See constructor. |
134 * @returns {Object} - new Collator object. | 134 * @returns {Object} - new Collator object. |
135 */ | 135 */ |
136 v8Locale.prototype.createCollator = function(settings) { | 136 v8Locale.prototype.createCollator = function(settings) { |
137 return new v8Locale.Collator(this, settings); | 137 return new v8Locale.__Collator(this, settings); |
138 }; | 138 }; |
139 | 139 |
140 /** | 140 /** |
141 * DateTimeFormat class implements locale-aware date and time formatting. | 141 * DateTimeFormat class implements locale-aware date and time formatting. |
142 * Constructor is not part of public API. | 142 * Constructor is not part of public API. |
143 * @param {Object} locale - locale object to pass to formatter. | 143 * @param {Object} locale - locale object to pass to formatter. |
144 * @param {Object} settings - formatting flags: | 144 * @param {Object} settings - formatting flags: |
145 * - skeleton | 145 * - skeleton |
146 * - dateType | 146 * - dateType |
147 * - timeType | 147 * - timeType |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 * @param {!Object} locale - user provided locale. | 258 * @param {!Object} locale - user provided locale. |
259 * @returns {Object} - v8Locale object. | 259 * @returns {Object} - v8Locale object. |
260 */ | 260 */ |
261 v8Locale.__createLocaleOrDefault = function(locale) { | 261 v8Locale.__createLocaleOrDefault = function(locale) { |
262 if (!locale || !(locale instanceof v8Locale)) { | 262 if (!locale || !(locale instanceof v8Locale)) { |
263 return new v8Locale(); | 263 return new v8Locale(); |
264 } else { | 264 } else { |
265 return locale; | 265 return locale; |
266 } | 266 } |
267 }; | 267 }; |
OLD | NEW |