awesome-cordova-plugins/src/plugins/globalization.ts

135 lines
5.0 KiB
TypeScript
Raw Normal View History

2016-07-08 07:06:34 +08:00
import { Cordova, Plugin } from './plugin';
2016-03-13 16:08:39 +08:00
/**
* @name Globalization
* @description
* @usage
* ```js
* import {Globalization} from 'ionic-native';
*
*
*
* ```
2016-03-13 16:08:39 +08:00
*/
@Plugin({
2016-07-18 01:44:19 +08:00
plugin: 'cordova-plugin-globalization',
pluginRef: 'navigator.globalization',
repo: 'https://github.com/apache/cordova-plugin-globalization'
2016-03-13 16:08:39 +08:00
})
export class Globalization {
/**
* Returns the BCP-47 compliant language identifier tag to the successCallback with a properties object as a parameter. That object should have a value property with a String value.
* @return {Promise<{value: string}>}
2016-03-13 16:08:39 +08:00
*/
@Cordova()
2016-07-18 01:44:19 +08:00
static getPreferredLanguage(): Promise<{ value: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
* Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
* @return {Promise<{value: string}>}
2016-03-13 16:08:39 +08:00
*/
@Cordova()
2016-07-18 01:44:19 +08:00
static getLocaleName(): Promise<{ value: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
* Converts date to string
2016-07-09 03:19:13 +08:00
* @param {Date} date Date you wish to convert
* @param options Options for the converted date. Length, selector.
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
2016-03-13 16:08:39 +08:00
*/
@Cordova({
2016-07-08 07:06:34 +08:00
successIndex: 1,
2016-07-18 12:08:21 +08:00
errorIndex: 2
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static dateToString(date: Date, options: { formatLength: string, selector: string }): Promise<{ value: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* 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.
* @param {string} dateString Date as a string to be converted
* @param options Options for the converted date. Length, selector.
* @return {Promise<{value: string}>} Returns a promise when the date has been converted.
2016-03-13 16:08:39 +08:00
*/
@Cordova({
2016-07-08 07:06:34 +08:00
successIndex: 1,
errorIndex: 2
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static stringToDate(dateString: string, options: { formatLength: string, selector: string }): Promise<{ year: number, month: number, day: number, hour: number, minute: number, second: number, millisecond: number }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Returns a pattern string to format and parse dates according to the client's user preferences.
* @param options Object with the format length and selector
* @return {Promise<{value: string}>} Returns a promise.
2016-03-13 16:08:39 +08:00
*/
@Cordova({
2016-07-08 07:06:34 +08:00
callbackOrder: 'reverse'
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static getDatePattern(options: { formatLength: string, selector: string }): Promise<{ pattern: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar.
* @param options Object with type (narrow or wide) and item (month or days).
* @return {Promise<{value: string}>} Returns a promise.
2016-03-13 16:08:39 +08:00
*/
@Cordova({
2016-07-08 07:06:34 +08:00
callbackOrder: 'reverse'
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static getDateNames(options: { type: string, item: string }): Promise<{ value: Array<string> }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar.
* @param {data} date Date to process
* @returns {Promise<dst>} reutrns a promise with the value
2016-03-13 16:08:39 +08:00
*/
@Cordova()
2016-07-18 01:44:19 +08:00
static isDayLightSavingsTime(date: Date): Promise<{ dst: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Returns the first day of the week according to the client's user preferences and calendar.
* @returns {Promise<value>} reutrns a promise with the value
2016-03-13 16:08:39 +08:00
*/
@Cordova()
2016-07-18 01:44:19 +08:00
static getFirstDayOfWeek(): Promise<{ value: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Returns a number formatted as a string according to the client's user preferences.
2016-03-13 16:08:39 +08:00
* @param options
*/
@Cordova({
2016-07-08 07:06:34 +08:00
successIndex: 1,
errorIndex: 2
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static numberToString(options: { type: string }): Promise<{ value: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
*
2016-07-09 03:19:13 +08:00
* @param {string} stringToConvert String you want to conver to a number
* @param options The type of number you want to return. Can be decimal, percent, or currency.
* @returns {Promise} Returns a promise with the value.
2016-03-13 16:08:39 +08:00
*/
@Cordova({
2016-07-08 07:06:34 +08:00
successIndex: 1,
errorIndex: 2
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static stringToNumber(stringToConvert: string, options: { type: string }): Promise<{ value: number | string }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Returns a pattern string to format and parse numbers according to the client's user preferences.
* @param options Can be decimal, percent, or currency.
* @returns {Promise} returns a promise with the value.
2016-03-13 16:08:39 +08:00
*/
@Cordova({
2016-07-08 07:06:34 +08:00
callbackOrder: 'reverse'
2016-03-13 16:08:39 +08:00
})
2016-07-18 01:44:19 +08:00
static getNumberPattern(options: { type: string }): Promise<{ pattern: string, symbol: string, fraction: number, rounding: number, positive: string, negative: string, decimal: string, grouping: string }> { return; }
2016-03-13 16:08:39 +08:00
/**
2016-07-09 03:19:13 +08:00
* Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 currency code.
* @param {string} currencyCode Currency Code.A
* @returns {Promise} returns a promise with the value
2016-03-13 16:08:39 +08:00
*/
@Cordova()
2016-07-18 01:44:19 +08:00
static getCurrencyPattern(currencyCode: string): Promise<{ pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string }> { return; }
2016-03-13 16:08:39 +08:00
}