| 1 |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
* vim: set ts=8 sts=2 et sw=2 tw=80: |
| 3 |
* This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
* License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 6 |
|
| 7 |
#ifndef js_experimental_Intl_h |
| 8 |
#define js_experimental_Intl_h |
| 9 |
|
| 10 |
#include "jstypes.h" // JS_PUBLIC_API |
| 11 |
|
| 12 |
#include "js/TypeDecls.h" |
| 13 |
|
| 14 |
namespace JS { |
| 15 |
|
| 16 |
/** |
| 17 |
* Create and add the Intl.MozDateTimeFormat constructor function to the |
| 18 |
* provided object. |
| 19 |
* |
| 20 |
* This custom date/time formatter constructor gives users the ability to |
| 21 |
* specify a custom format pattern. This pattern is passed *directly* to ICU |
| 22 |
* with NO SYNTAX PARSING OR VALIDATION WHATSOEVER. ICU appears to have a |
| 23 |
* modicum of testing of this, and it won't fall over completely if passed bad |
| 24 |
* input. But the current behavior is entirely under-specified and emphatically |
| 25 |
* not shippable on the web, and it *must* be fixed before this functionality |
| 26 |
* can be exposed in the real world. (There are also some questions about |
| 27 |
* whether the format exposed here is the *right* one to standardize, that will |
| 28 |
* also need to be resolved to ship this.) |
| 29 |
* |
| 30 |
* If JS was built without JS_HAS_INTL_API, this function will throw an |
| 31 |
* exception. |
| 32 |
*/ |
| 33 |
extern JS_PUBLIC_API bool AddMozDateTimeFormatConstructor( |
| 34 |
JSContext* cx, Handle<JSObject*> intl); |
| 35 |
|
| 36 |
/** |
| 37 |
* Create and add the Intl.MozDisplayNames constructor function to the |
| 38 |
* provided object. This constructor acts like the standard |Intl.DisplayNames| |
| 39 |
* but accepts certain additional syntax that isn't standardized to the point of |
| 40 |
* being shippable. |
| 41 |
* |
| 42 |
* If JS was built without JS_HAS_INTL_API, this function will throw an |
| 43 |
* exception. |
| 44 |
*/ |
| 45 |
extern JS_PUBLIC_API bool AddMozDisplayNamesConstructor(JSContext* cx, |
| 46 |
Handle<JSObject*> intl); |
| 47 |
|
| 48 |
} // namespace JS |
| 49 |
|
| 50 |
#endif // js_experimental_Intl_h |