Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8162910ED3 for ; Wed, 26 Jun 2013 22:15:58 +0000 (UTC) Received: (qmail 85362 invoked by uid 500); 26 Jun 2013 22:15:58 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 85296 invoked by uid 500); 26 Jun 2013 22:15:58 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 85180 invoked by uid 99); 26 Jun 2013 22:15:58 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jun 2013 22:15:58 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CA0B91DB99; Wed, 26 Jun 2013 22:15:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mwbrooks@apache.org To: commits@cordova.apache.org Date: Wed, 26 Jun 2013 22:16:04 -0000 Message-Id: <0a1d86bf6a3f41f696a6b163aacf6bff@git.apache.org> In-Reply-To: <094cb4246f8d44e18b0e1afc20d5e913@git.apache.org> References: <094cb4246f8d44e18b0e1afc20d5e913@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/12] Version 2.9.0 http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/PositionError/positionError.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/PositionError/positionError.md b/docs/en/2.9.0/cordova/geolocation/PositionError/positionError.md new file mode 100755 index 0000000..07200d5 --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/PositionError/positionError.md @@ -0,0 +1,60 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +PositionError +======== + +A `PositionError` object is passed to the `geolocationError` callback when an error occurs. + +Properties +---------- + +- __code__: One of the predefined error codes listed below. +- __message__: Error message describing the details of the error encountered. + +Constants +--------- + +- `PositionError.PERMISSION_DENIED` +- `PositionError.POSITION_UNAVAILABLE` +- `PositionError.TIMEOUT` + +Description +----------- + +The `PositionError` object is passed to the `geolocationError` +callback function when an error occurs with geolocation. + +### `PositionError.PERMISSION_DENIED` + +Returned when the user does not allow your application to retrieve +position information. This is dependent on the platform. + +### `PositionError.POSITION_UNAVAILABLE` + +Returned when the device is unable to retrieve a position. In general +this means the device has no network connectivity and/or cannot get a +satellite fix. + +### `PositionError.TIMEOUT` + +Returned when the device is unable to retrieve a position within the +time specified in the `geolocationOptions`' `timeout` property. When +used with `geolocation.watchPosition`, this error could be passed to +the `geolocationError` callback every `timeout` milliseconds. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/geolocation.clearWatch.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/geolocation.clearWatch.md b/docs/en/2.9.0/cordova/geolocation/geolocation.clearWatch.md new file mode 100644 index 0000000..4ce1b7e --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/geolocation.clearWatch.md @@ -0,0 +1,119 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +geolocation.clearWatch +====================== + +Stop watching for changes to the device's location referenced by the +`watchID` parameter. + + navigator.geolocation.clearWatch(watchID); + +Parameters +---------- + +- __watchID__: The id of the `watchPosition` interval to clear. (String) + +Description +----------- + +The `geolocation.clearWatch` stops watching changes to the device's +location by clearing the `geolocation.watchPosition` referenced by +`watchID`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +Quick Example +------------- + + // Options: watch for changes in position, and use the most + // accurate position acquisition method available. + // + var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true }); + + // ...later on... + + navigator.geolocation.clearWatch(watchID); + +Full Example +------------ + + + + + Device Properties Example + + + + + +

Watching geolocation...

+ + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/geolocation.getCurrentPosition.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/geolocation.getCurrentPosition.md b/docs/en/2.9.0/cordova/geolocation/geolocation.getCurrentPosition.md new file mode 100644 index 0000000..e4ac566 --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/geolocation.getCurrentPosition.md @@ -0,0 +1,129 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +geolocation.getCurrentPosition +============================== + +Returns the device's current position as a `Position` object. + + navigator.geolocation.getCurrentPosition(geolocationSuccess, + [geolocationError], + [geolocationOptions]); + +Parameters +---------- + +- __geolocationSuccess__: The callback that is passed the current position. +- __geolocationError__: _(Optional)_ The callback that executes if an error occurs. +- __geolocationOptions__: _(Optional)_ The geolocation options. + +Description +----------- + +`geolocation.getCurrentPosition` is an asynchronous function. It +returns the device's current position to the `geolocationSuccess` +callback with a `Position` object as the parameter. If there is an +error, the `geolocationError` callback is passed a +`PositionError` object. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +Quick Example +------------- + + // onSuccess Callback + // This method accepts a Position object, which contains the + // current GPS coordinates + // + var onSuccess = function(position) { + alert('Latitude: ' + position.coords.latitude + '\n' + + 'Longitude: ' + position.coords.longitude + '\n' + + 'Altitude: ' + position.coords.altitude + '\n' + + 'Accuracy: ' + position.coords.accuracy + '\n' + + 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' + + 'Heading: ' + position.coords.heading + '\n' + + 'Speed: ' + position.coords.speed + '\n' + + 'Timestamp: ' + position.timestamp + '\n'); + }; + + // onError Callback receives a PositionError object + // + function onError(error) { + alert('code: ' + error.code + '\n' + + 'message: ' + error.message + '\n'); + } + + navigator.geolocation.getCurrentPosition(onSuccess, onError); + +Full Example +------------ + + + + + Device Properties Example + + + + + +

Finding geolocation...

+ + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/geolocation.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/geolocation.md b/docs/en/2.9.0/cordova/geolocation/geolocation.md new file mode 100644 index 0000000..e771411 --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/geolocation.md @@ -0,0 +1,104 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +Geolocation +=========== + +> The `geolocation` object provides access to location data based on the device's GPS sensor or inferred from network signals. + +`Geolocation` provides information about the device's location, such as +latitude and longitude. Common sources of location information include +Global Positioning System (GPS) and location inferred from network +signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, +and GSM/CDMA cell IDs. There is no guarantee that the API returns the +device's actual location. + +This API is based on the +[W3C Geolocation API Specification](http://dev.w3.org/geo/api/spec-source.html), +and only executes on devices that don't already provide an implementation. + +**Important privacy note:** Collection and use of geolocation data raises important privacy issues. Your app's [privacy policy](guide_getting-started_index.md.html) should discuss how the app uses geolocation data, whether it is shared with any other parties, and the level of precision of the data (for example, coarse, fine, ZIP code level, etc.). Geolocation data is generally considered sensitive because it can reveal a person's whereabouts and, if stored, the history of his or her travels. Therefore, in addition to your app's privacy policy, you should strongly consider providing a just-in-time notice prior to your app accessing geolocation data (if the device operating system doesn't do so already). That notice should provide the same information noted above, as well as obtaining the user's permission (e.g., by presenting choices for "OK" and "No Thanks"). For more information, please see the Privacy Guide. + +Methods +------- + +- geolocation.getCurrentPosition +- geolocation.watchPosition +- geolocation.clearWatch + +Arguments +--------- + +- geolocationSuccess +- geolocationError +- geolocationOptions + +Objects (Read-Only) +------------------- + +- Position +- PositionError +- Coordinates + +Permissions +----------- + +### Android + +#### app/res/xml/config.xml + + + +#### app/AndroidManifest.xml + + + + + +### BlackBerry WebWorks + +#### www/plugins.xml + + + +#### www/config.xml + + + read_geolocation + + +### iOS + +#### config.xml + + + +### Windows Phone + +#### Properties/WPAppManifest.xml + + + + + +Reference: [Application Manifest for Windows Phone](http://msdn.microsoft.com/en-us/library/ff769509%28v=vs.92%29.aspx) + +### Tizen + + No permissions are required. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/geolocation.watchPosition.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/geolocation.watchPosition.md b/docs/en/2.9.0/cordova/geolocation/geolocation.watchPosition.md new file mode 100644 index 0000000..24cde98 --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/geolocation.watchPosition.md @@ -0,0 +1,132 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +geolocation.watchPosition +========================= + +Watches for changes to the device's current position. + + var watchId = navigator.geolocation.watchPosition(geolocationSuccess, + [geolocationError], + [geolocationOptions]); + +Parameters +---------- + +- __geolocationSuccess__: The callback that is passed the current position. +- __geolocationError__: (Optional) The callback that executes if an error occurs. +- __geolocationOptions__: (Optional) The geolocation options. + +Returns +------- + +- __String__: returns a watch id that references the watch position interval. The watch id should be used with `geolocation.clearWatch` to stop watching for changes in position. + +Description +----------- + +`geolocation.watchPosition` is an asynchronous function. It returns +the device's current position when a change in position is detected. +When the device retrieves a new location, the `geolocationSuccess` +callback executes with a `Position` object as the parameter. If +there is an error, the `geolocationError` callback executes with a +`PositionError` object as the parameter. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Tizen +- Windows Phone 7 and 8 +- Windows 8 + +Quick Example +------------- + + // onSuccess Callback + // This method accepts a `Position` object, which contains + // the current GPS coordinates + // + function onSuccess(position) { + var element = document.getElementById('geolocation'); + element.innerHTML = 'Latitude: ' + position.coords.latitude + '
' + + 'Longitude: ' + position.coords.longitude + '
' + + '
' + element.innerHTML; + } + + // onError Callback receives a PositionError object + // + function onError(error) { + alert('code: ' + error.code + '\n' + + 'message: ' + error.message + '\n'); + } + + // Options: throw an error if no update is received every 30 seconds. + // + var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 }); + +Full Example +------------ + + + + + Device Properties Example + + + + + +

Watching geolocation...

+ + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/parameters/geolocation.options.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/parameters/geolocation.options.md b/docs/en/2.9.0/cordova/geolocation/parameters/geolocation.options.md new file mode 100644 index 0000000..ba6cd54 --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/parameters/geolocation.options.md @@ -0,0 +1,39 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +geolocationOptions +================== + +Optional parameters to customize the retrieval of the geolocation +`Position`. + + { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true }; + +Options +------- + +- __enableHighAccuracy__: Provides a hint that the application needs the best possible results. By default, the device attempts to retrieve a `Position` using network-based methods. Setting this property to `true` tells the framework to use more accurate methods, such as satellite positioning. _(Boolean)_ +- __timeout__: The maximum length of time (milliseconds) that is allowed to pass from the call to `geolocation.getCurrentPosition` or `geolocation.watchPosition` until the corresponding `geolocationSuccess` callback executes. If the `geolocationSuccess` callback is not invoked within this time, the `geolocationError` callback is passed a `PositionError.TIMEOUT` error code. (Note that when used in conjunction with `geolocation.watchPosition`, the `geolocationError` callback could be called on an interval every `timeout` milliseconds!) _(Number)_ +- __maximumAge__: Accept a cached position whose age is no greater than the specified time in milliseconds. _(Number)_ + +Android Quirks +-------------- + +Android 2.x simulators do not return a geolocation result unless the `enableHighAccuracy` option is set to `true`. + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/parameters/geolocationError.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/parameters/geolocationError.md b/docs/en/2.9.0/cordova/geolocation/parameters/geolocationError.md new file mode 100644 index 0000000..c087165 --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/parameters/geolocationError.md @@ -0,0 +1,33 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +geolocationError +================ + +The user's callback function that executes when there is an error for +geolocation functions. + + function(error) { + // Handle the error + } + +Parameters +---------- + +- __error__: The error returned by the device. _(PositionError)_ http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/geolocation/parameters/geolocationSuccess.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/geolocation/parameters/geolocationSuccess.md b/docs/en/2.9.0/cordova/geolocation/parameters/geolocationSuccess.md new file mode 100644 index 0000000..8df414a --- /dev/null +++ b/docs/en/2.9.0/cordova/geolocation/parameters/geolocationSuccess.md @@ -0,0 +1,49 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +geolocationSuccess +================== + +The user's callback function that executes when a geolocation position +becomes available (when called from `geolocation.getCurrentPosition`), +or when the position changes (when called from +`geolocation.watchPosition`). + + function(position) { + // Do something + } + +Parameters +---------- + +- __position__: The geolocation position returned by the device. _(Position)_ + +Example +------- + + function geolocationSuccess(position) { + alert('Latitude: ' + position.coords.latitude + '\n' + + 'Longitude: ' + position.coords.longitude + '\n' + + 'Altitude: ' + position.coords.altitude + '\n' + + 'Accuracy: ' + position.coords.accuracy + '\n' + + 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' + + 'Heading: ' + position.coords.heading + '\n' + + 'Speed: ' + position.coords.speed + '\n' + + 'Timestamp: ' + position.timestamp + '\n'); + } http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/GlobalizationError/globalizationerror.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/GlobalizationError/globalizationerror.md b/docs/en/2.9.0/cordova/globalization/GlobalizationError/globalizationerror.md new file mode 100644 index 0000000..015510b --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/GlobalizationError/globalizationerror.md @@ -0,0 +1,94 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +GlobalizationError +============ + +An object representing a error from the Globalization API. + +Properties +---------- + +- __code__: One of the following codes representing the error type _(Number)_ + - GlobalizationError.UNKNOWN\_ERROR: 0 + - GlobalizationError.FORMATTING\_ERROR: 1 + - GlobalizationError.PARSING\_ERROR: 2 + - GlobalizationError.PATTERN\_ERROR: 3 +- __message__: A text message that includes the error's explanation and/or details _(String)_ + +Description +----------- + +This object is created and populated by Cordova, and returned to a callback in the case of an error. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS + +Quick Example +------------- + +When the following error callback executes, it displays a +popup dialog with the text similar to `code: 3` and `message:` + + function errorCallback(error) { + alert('code: ' + error.code + '\n' + + 'message: ' + error.message + '\n'); + }; + +Full Example +------------ + + + + + GlobalizationError Example + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.dateToString.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.dateToString.md b/docs/en/2.9.0/cordova/globalization/globalization.dateToString.md new file mode 100644 index 0000000..da117bc --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.dateToString.md @@ -0,0 +1,97 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.dateToString +=========== + +Returns a date formatted as a string according to the client's locale and timezone. + + navigator.globalization.dateToString(date, successCallback, errorCallback, options); + +Description +----------- + +Returns the formatted date `String` via a `value` property accessible +from the object passed as a parameter to the `successCallback`. + +The inbound `date` parameter should be of type `Date`. + +If there is an error formatting the date, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.FORMATTING\_ERROR`. + +The `options` parameter is optional, and its default values are: + + {formatLength:'short', selector:'date and time'} + +The `options.formatLength` can be `short`, `medium`, `long`, or `full`. + +The `options.selector` can be `date`, `time` or `date and time`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +If the browser is set to the `en\_US` locale, this displays a popup +dialog with text similar to `date: 9/25/2012 4:21PM` using the default +options: + + navigator.globalization.dateToString( + new Date(), + function (date) { alert('date: ' + date.value + '\n'); }, + function () { alert('Error getting dateString\n'); }, + { formatLength: 'short', selector: 'date and time' } + ); + +Full Example +------------ + + + + + dateToString Example + + + + + + + + +Windows Phone 8 Quirks +-------------- + +- The `formatLength` option supports only `short` and `full` values. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getCurrencyPattern.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getCurrencyPattern.md b/docs/en/2.9.0/cordova/globalization/globalization.getCurrencyPattern.md new file mode 100644 index 0000000..3d49d16 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getCurrencyPattern.md @@ -0,0 +1,112 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getCurrencyPattern +=========== + +Returns a pattern string to format and parse currency values according +to the client's user preferences and ISO 4217 currency code. + + navigator.globalization.getCurrencyPattern(currencyCode, successCallback, errorCallback); + +Description +----------- + +Returns the pattern to the `successCallback` with a `properties` object +as a parameter. That object should contain the following properties: + +- __pattern__: The currency pattern to format and parse currency values. The patterns follow Unicode Technical Standard #35. . _(String)_ +- __code__: The ISO 4217 currency code for the pattern. _(String)_ +- __fraction__: The number of fractional digits to use when parsing and formatting currency. _(Number)_ +- __rounding__: The rounding increment to use when parsing and formatting. _(Number)_ +- __decimal__: The decimal symbol to use for parsing and formatting. _(String)_ +- __grouping__: The grouping symbol to use for parsing and formatting. _(String)_ + +The inbound `currencyCode` parameter should be a `String` of one of +the ISO 4217 currency codes, for example 'USD'. + +If there is an error obtaining the pattern, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.FORMATTING\_ERROR`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS + +Quick Example +------------- + +When the browser is set to the `en\_US` locale and the selected +currency is United States Dollars, this example displays a popup +dialog with text similar to the results that follow: + + navigator.globalization.getCurrencyPattern( + 'USD', + function (pattern) { + alert('pattern: ' + pattern.pattern + '\n' + + 'code: ' + pattern.code + '\n' + + 'fraction: ' + pattern.fraction + '\n' + + 'rounding: ' + pattern.rounding + '\n' + + 'decimal: ' + pattern.decimal + '\n' + + 'grouping: ' + pattern.grouping); + }, + function () { alert('Error getting pattern\n'); } + ); + +Expected result: + + pattern: $#,##0.##;($#,##0.##) + code: USD + fraction: 2 + rounding: 0 + decimal: . + grouping: , + +Full Example +------------ + + + + + getCurrencyPattern Example + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getDateNames.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getDateNames.md b/docs/en/2.9.0/cordova/globalization/globalization.getDateNames.md new file mode 100644 index 0000000..389cfa6 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getDateNames.md @@ -0,0 +1,102 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getDateNames +=========== + +Returns an array of the names of the months or days of the week, +depending on the client's user preferences and calendar. + + navigator.globalization.getDateNames(successCallback, errorCallback, options); + +Description +----------- + +Returns the array of names to the `successCallback` with a +`properties` object as a parameter. That object contains a `value` +property with an `Array` of `String` values. The array features names +starting from either the first month in the year or the first day of +the week, depending on the option selected. + +If there is an error obtaining the names, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.UNKNOWN\_ERROR`. + +The `options` parameter is optional, and its default values are: + + {type:'wide', item:'months'} + +The value of `options.type` can be `narrow` or `wide`. + +The value of `options.item` can be `months` or `days`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this example displays +a series of twelve popup dialogs, one per month, with text similar to +`month: January`: + + navigator.globalization.getDateNames( + function (names) { + for (var i = 0; i < names.value.length; i++) { + alert('month: ' + names.value[i] + '\n'); + } + }, + function () { alert('Error getting names\n'); }, + { type: 'wide', item: 'months' } + ); + +Full Example +------------ + + + + + getDateNames Example + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getDatePattern.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getDatePattern.md b/docs/en/2.9.0/cordova/globalization/globalization.getDatePattern.md new file mode 100644 index 0000000..14ee0a6 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getDatePattern.md @@ -0,0 +1,105 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getDatePattern +=========== + +Returns a pattern string to format and parse dates according to the +client's user preferences. + + navigator.globalization.getDatePattern(successCallback, errorCallback, options); + +Description +----------- + +Returns the pattern to the `successCallback`. The object passed in as +a parameter contains the following properties: + +- __pattern__: The date and time pattern to format and parse dates. The patterns follow Unicode Technical Standard #35. . _(String)_ +- __timezone__: The abbreviated name of the time zone on the client. _(String)_ +- __utc\_offset__: The current difference in seconds between the client's time zone and coordinated universal time. _(Number)_ +- __dst\_offset__: The current daylight saving time offset in seconds between the client's non-daylight saving's time zone and the client's daylight saving's time zone. _(Number)_ + +If there is an error obtaining the pattern, the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.PATTERN\_ERROR`. + +The `options` parameter is optional, and defaults to the following values: + + {formatLength:'short', selector:'date and time'} + +The `options.formatLength` can be `short`, `medium`, `long`, or +`full`. The `options.selector` can be `date`, `time` or `date and +time`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this example displays +a popup dialog with text such as `pattern: M/d/yyyy h:mm a`: + + function checkDatePattern() { + navigator.globalization.getDatePattern( + function (date) { alert('pattern: ' + date.pattern + '\n'); }, + function () { alert('Error getting pattern\n'); }, + { formatLength: 'short', selector: 'date and time' } + ); + } + +Full Example +------------ + + + + + getDatePattern Example + + + + + + + + +Windows Phone 8 Quirks +-------------- + +- The `formatLength` supports only `short` and `full` values. +- The `pattern` for `date and time` pattern returns only full datetime format. +- The `timezone` returns the full time zone name. +- The `dst_offset` property is not supported, and always returns zero. + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getFirstDayOfWeek.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getFirstDayOfWeek.md b/docs/en/2.9.0/cordova/globalization/globalization.getFirstDayOfWeek.md new file mode 100644 index 0000000..cb095e9 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getFirstDayOfWeek.md @@ -0,0 +1,82 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getFirstDayOfWeek +=========== + +Returns the first day of the week according to the client's user +preferences and calendar. + + navigator.globalization.getFirstDayOfWeek(successCallback, errorCallback); + +Description +----------- + +The days of the week are numbered starting from 1, where 1 is assumed +to be Sunday. Returns the day to the `successCallback` with a +`properties` object as a parameter. That object should have a `value` +property with a `Number` value. + +If there is an error obtaining the pattern, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.UNKNOWN\_ERROR`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this displays a +popup dialog with text similar to `day: 1`. + + navigator.globalization.getFirstDayOfWeek( + function (day) {alert('day: ' + day.value + '\n');}, + function () {alert('Error getting day\n');} + ); + +Full Example +------------ + + + + + getFirstDayOfWeek Example + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getLocaleName.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getLocaleName.md b/docs/en/2.9.0/cordova/globalization/globalization.getLocaleName.md new file mode 100644 index 0000000..52a0226 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getLocaleName.md @@ -0,0 +1,83 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getLocaleName +=========== + +Get the string identifier for the client's current locale setting. + + navigator.globalization.getLocaleName(successCallback, errorCallback); + + +Description +----------- + +Returns the locale identifier string to the `successCallback` with a +`properties` object as a parameter. That object should have a `value` +property with a `String` value. + +If there is an error getting the locale, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.UNKNOWN\_ERROR`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this displays a popup +dialog with the text `locale: en\_US`. + + navigator.globalization.getLocaleName( + function (locale) {alert('locale: ' + locale.value + '\n');}, + function () {alert('Error getting locale\n');} + ); + +Full Example +------------ + + + + + getLocaleName Example + + + + + + + + +Windows Phone 8 Quirks +--------------------- +- Returns the two-letter code defined in ISO 3166 for the current country/region. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getNumberPattern.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getNumberPattern.md b/docs/en/2.9.0/cordova/globalization/globalization.getNumberPattern.md new file mode 100644 index 0000000..70f0027 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getNumberPattern.md @@ -0,0 +1,125 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getNumberPattern +=========== + +Returns a pattern string to format and parse numbers according to the client's user preferences. + + navigator.globalization.getNumberPattern(successCallback, errorCallback, options); + +Description +----------- + +Returns the pattern to the `successCallback` with a `properties` object +as a parameter. That object contains the following properties: + +- __pattern__: The number pattern to format and parse numbers. The patterns follow Unicode Technical Standard #35. . _(String)_ +- __symbol__: The symbol to use when formatting and parsing, such as a percent or currency symbol. _(String)_ +- __fraction__: The number of fractional digits to use when parsing and formatting numbers. _(Number)_ +- __rounding__: The rounding increment to use when parsing and formatting. _(Number)_ +- __positive__: The symbol to use for positive numbers when parsing and formatting. _(String)_ +- __negative__: The symbol to use for negative numbers when parsing and formatting. _(String)_ +- __decimal__: The decimal symbol to use for parsing and formatting. _(String)_ +- __grouping__: The grouping symbol to use for parsing and formatting. _(String)_ + +If there is an error obtaining the pattern, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.PATTERN\_ERROR`. + +The `options` parameter is optional, and default values are: + + {type:'decimal'} + +The `options.type` can be `decimal`, `percent`, or `currency`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this should display a +popup dialog with text similar to the results that follow: + + navigator.globalization.getNumberPattern( + function (pattern) {alert('pattern: ' + pattern.pattern + '\n' + + 'symbol: ' + pattern.symbol + '\n' + + 'fraction: ' + pattern.fraction + '\n' + + 'rounding: ' + pattern.rounding + '\n' + + 'positive: ' + pattern.positive + '\n' + + 'negative: ' + pattern.negative + '\n' + + 'decimal: ' + pattern.decimal + '\n' + + 'grouping: ' + pattern.grouping);}, + function () {alert('Error getting pattern\n');}, + {type:'decimal'} + ); + +Results: + + pattern: #,##0.### + symbol: . + fraction: 0 + rounding: 0 + positive: + negative: - + decimal: . + grouping: , + +Full Example +------------ + + + + + getNumberPattern Example + + + + + + + + +Windows Phone 8 Quirks +---------------- +- The `pattern` property is not supported, and retuens an empty string. +- The `fraction` property is not supported, and returns zero. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.getPreferredLanguage.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.getPreferredLanguage.md b/docs/en/2.9.0/cordova/globalization/globalization.getPreferredLanguage.md new file mode 100644 index 0000000..4e3b54b --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.getPreferredLanguage.md @@ -0,0 +1,83 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.getPreferredLanguage +=========== + +Get the string identifier for the client's current language. + + navigator.globalization.getPreferredLanguage(successCallback, errorCallback); + + +Description +----------- + +Returns the language identifier string to the `successCallback` with a +`properties` object as a parameter. That object should have a `value` +property with a `String` value. + +If there is an error getting the language, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.UNKNOWN\_ERROR`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this should display a +popup dialog with the text `language: English`: + + navigator.globalization.getPreferredLanguage( + function (language) {alert('language: ' + language.value + '\n');}, + function () {alert('Error getting language\n');} + ); + +Full Example +------------ + + + + + getPreferredLanguage Example + + + + + + + + +Windows Phone 8 Quirks +------- +- Returns the ISO 639-1 two-letter code for the current language. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.isDayLightSavingsTime.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.isDayLightSavingsTime.md b/docs/en/2.9.0/cordova/globalization/globalization.isDayLightSavingsTime.md new file mode 100644 index 0000000..e6d3f2f --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.isDayLightSavingsTime.md @@ -0,0 +1,87 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.isDayLightSavingsTime +=========== + +Indicates whether daylight savings time is in effect for a given date +using the client's time zone and calendar. + + navigator.globalization.isDayLightSavingsTime(date, successCallback, errorCallback); + +Description +----------- + +Indicates whether or not daylight savings time is in effect to the +`successCallback` with a `properties` object as a parameter. That object +should have a `dst` property with a `Boolean` value. A `true` value +indicates that daylight savings time is in effect for the given date, +and `false` indicates that it is not. + +The inbound parameter `date` should be of type `Date`. + +If there is an error reading the date, then the `errorCallback` +executes. The error's expected code is `GlobalizationError.UNKNOWN\_ERROR`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +During the summer, and if the browser is set to a DST-enabled +timezone, this should display a popup dialog with text similar to +`dst: true`: + + navigator.globalization.isDayLightSavingsTime( + new Date(), + function (date) {alert('dst: ' + date.dst + '\n');}, + function () {alert('Error getting names\n');} + ); + +Full Example +------------ + + + + + isDayLightSavingsTime Example + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.md b/docs/en/2.9.0/cordova/globalization/globalization.md new file mode 100644 index 0000000..b473ec9 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.md @@ -0,0 +1,63 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +Globalization +====== + +Obtains information and performs operations specific to the user's +locale and timezone. + +Objects +------- + +- GlobalizationError + +Methods +------- + +- globalization.getPreferredLanguage +- globalization.getLocaleName +- globalization.dateToString +- globalization.stringToDate +- globalization.getDatePattern +- globalization.getDateNames +- globalization.isDayLightSavingsTime +- globalization.getFirstDayOfWeek +- globalization.numberToString +- globalization.stringToNumber +- globalization.getNumberPattern +- globalization.getCurrencyPattern + +Variable Scope +-------------- + +The `globalization` object is a child of the `navigator` object, and +therefore has global scope. + + // The global globalization object + var globalization = navigator.globalization; + +Permissions +----------- + +### Android + +#### app/res/xml/config.xml + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.numberToString.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.numberToString.md b/docs/en/2.9.0/cordova/globalization/globalization.numberToString.md new file mode 100644 index 0000000..800955e --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.numberToString.md @@ -0,0 +1,90 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.numberToString +=========== + +Returns a number formatted as a string according to the client's user preferences. + + navigator.globalization.numberToString(number, successCallback, errorCallback, options); + +Description +----------- + +Returns the formatted number string to the `successCallback` with a +`properties` object as a parameter. That object should have a `value` +property with a `String` value. + +If there is an error formatting the number, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.FORMATTING\_ERROR`. + +The `options` parameter is optional, and its default values are: + + {type:'decimal'} + +The `options.type` can be 'decimal', 'percent', or 'currency'. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this displays a popup +dialog with text similar to `number: 3.142`: + + navigator.globalization.numberToString( + 3.1415926, + function (number) {alert('number: ' + number.value + '\n');}, + function () {alert('Error getting number\n');}, + {type:'decimal'} + ); + +Full Example +------------ + + + + + numberToString Example + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.stringToDate.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.stringToDate.md b/docs/en/2.9.0/cordova/globalization/globalization.stringToDate.md new file mode 100644 index 0000000..a1b9350 --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.stringToDate.md @@ -0,0 +1,114 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.stringToDate +=========== + +Parses a date formatted as a string, according to the client's user +preferences and calendar using the time zone of the client, and +returns the corresponding date object. + + navigator.globalization.stringToDate(dateString, successCallback, errorCallback, options); + +Description +----------- + +Returns the date to the success callback with a `properties` object as +a parameter. That object should have the following properties: + +- __year__: The four digit year. _(Number)_ +- __month__: The month from (0 - 11). _(Number)_ +- __day__: The day from (1 - 31). _(Number)_ +- __hour__: The hour from (0 - 23). _(Number)_ +- __minute__: The minute from (0 - 59). _(Number)_ +- __second__: The second from (0 - 59). _(Number)_ +- __millisecond__: The milliseconds (from 0 - 999), not available on all platforms. _(Number)_ + +The inbound `dateString` parameter should be of type `String`. + +The `options` parameter is optional, and defaults to the following +values: + + {formatLength:'short', selector:'date and time'} + +The `options.formatLength` can be `short`, `medium`, `long`, or +`full`. The `options.selector` can be `date`, `time` or `date and +time`. + +If there is an error parsing the date string, then the `errorCallback` +executes with a `GlobalizationError` object as a parameter. The +error's expected code is `GlobalizationError.PARSING\_ERROR`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this displays a +popup dialog with text similar to `month:8 day:25 year:2012`. Note +that the month integer is one less than the string, as the month +integer represents an array index. + + navigator.globalization.stringToDate( + '9/25/2012', + function (date) {alert('month:' + date.month + + ' day:' + date.day + + ' year:' + date.year + '\n');}, + function () {alert('Error getting date\n');}, + {selector: 'date'} + ); + +Full Example +------------ + + + + + stringToDate Example + + + + + + + + +Windows Phone 8 Quirks +------------------ + +- The `formatLength` option supports only `short` and `full` values. http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/9d152990/docs/en/2.9.0/cordova/globalization/globalization.stringToNumber.md ---------------------------------------------------------------------- diff --git a/docs/en/2.9.0/cordova/globalization/globalization.stringToNumber.md b/docs/en/2.9.0/cordova/globalization/globalization.stringToNumber.md new file mode 100644 index 0000000..738491e --- /dev/null +++ b/docs/en/2.9.0/cordova/globalization/globalization.stringToNumber.md @@ -0,0 +1,93 @@ +--- +license: Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--- + +globalization.stringToNumber +=========== + +Parses a number formatted as a string according to the client's user +preferences and returns the corresponding number. + + navigator.globalization.stringToNumber(string, successCallback, errorCallback, options); + +Description +----------- + +Returns the number to the `successCallback` with a `properties` object +as a parameter. That object should have a `value` property with a +`Number` value. + +If there is an error parsing the number string, then the +`errorCallback` executes with a `GlobalizationError` object as a +parameter. The error's expected code is +`GlobalizationError.PARSING\_ERROR`. + +The `options` parameter is optional, and defaults to the following +values: + + {type:'decimal'} + +The `options.type` can be `decimal`, `percent`, or `currency`. + +Supported Platforms +------------------- + +- Android +- BlackBerry WebWorks (OS 5.0 and higher) +- iOS +- Windows Phone 8 + +Quick Example +------------- + +When the browser is set to the `en\_US` locale, this should display a +popup dialog with text similar to `number: 1234.56`: + + navigator.globalization.stringToNumber( + '1234.56', + function (number) {alert('number: ' + number.value + '\n');}, + function () {alert('Error getting number\n');}, + {type:'decimal'} + ); + +Full Example +------------ + + + + + stringToNumber Example + + + + + + + +