From 90cc36b453f29f0f0960823155d2e3a8a44665bc Mon Sep 17 00:00:00 2001
From: Ibrahim Hadeed <ibby93@gmail.com>
Date: Sun, 13 Mar 2016 04:08:39 -0400
Subject: [PATCH] feat(plugin): add globalization

---
 src/index.ts                 |   3 +
 src/plugins/globalization.ts | 122 +++++++++++++++++++++++++++++++++++
 src/plugins/sms.ts           |   2 +-
 3 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 src/plugins/globalization.ts

diff --git a/src/index.ts b/src/index.ts
index 346609a16..3eabf008a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -26,6 +26,7 @@ import {Facebook} from './plugins/facebook';
 //import {File} from './plugins/file';
 import {Flashlight} from './plugins/flashlight';
 import {Geolocation} from './plugins/geolocation';
+import {Globalization} from './plugins/globalization';
 import {ImagePicker} from './plugins/imagepicker';
 import {LaunchNavigator} from './plugins/launchnavigator';
 import {LocalNotifications} from './plugins/localnotifications';
@@ -57,6 +58,7 @@ export {
   //File,
   Flashlight,
   Geolocation,
+  Globalization,
   ImagePicker,
   LaunchNavigator,
   LocalNotifications,
@@ -92,6 +94,7 @@ window['IonicNative'] = {
   //File: File,
   Flashlight: Flashlight,
   Geolocation: Geolocation,
+  Globalization: Globalization,
   ImagePicker: ImagePicker,
   LaunchNavigator: LaunchNavigator,
   LocalNotifications: LocalNotifications,
diff --git a/src/plugins/globalization.ts b/src/plugins/globalization.ts
new file mode 100644
index 000000000..1e48c1d5f
--- /dev/null
+++ b/src/plugins/globalization.ts
@@ -0,0 +1,122 @@
+import {Plugin, Cordova} from './plugin';
+
+/**
+ * @name Globalization
+ * @description
+ * @usage
+ */
+@Plugin({
+  plugin: 'cordova-plugin-globalization',
+  pluginRef: 'navigator.globalization',
+  repo: 'https://github.com/apache/cordova-plugin-globalization'
+})
+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}>}
+   */
+  @Cordova()
+  static getPreferredLanguage() : Promise<{value:string}> {return}
+
+  /**
+   * Returns the BCP 47 compliant locale identifier string to the successCallback with a properties object as a parameter.
+   * @return {Promise<{value:string}>}
+   */
+  @Cordova()
+  static getLocaleName() : Promise<{value:string}> {return}
+
+  /**
+   * Converts date to string
+   * @param date
+   * @param options
+   * @return {Promise<{value:string}>}
+   */
+  @Cordova({
+    successIndex: 1,
+    errorIndex: 2
+  })
+  static dateToString(date : Date, options : {formatLength:string, selector:string}) : Promise<{value:string}> {return}
+
+  /**
+   *
+   * @param dateString
+   * @param options
+   */
+  @Cordova({
+    successIndex: 1,
+    errorIndex: 2
+  })
+  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}
+
+
+  /**
+   *
+   * @param options
+   */
+  @Cordova({
+    callbackOrder: 'reverse'
+  })
+  static getDatePattern(options:{formatLength:string, selector:string}) : Promise<{pattern:string}> {return}
+
+
+  /**
+   *
+   * @param options
+   */
+  @Cordova({
+    callbackOrder: 'reverse'
+  })
+  static getDateNames(options:{type,item}) : Promise<{value:Array<string>}> {return}
+
+  /**
+   * Check if day light saving is active
+   * @param date
+   */
+  @Cordova()
+  static isDayLightSavingsTime(date:Date) : Promise<{dst:string}> {return}
+
+  /**
+   * Get first day of week
+   */
+  @Cordova()
+  static getFirstDayOfWeek() : Promise<{value:string}> {return}
+
+  /**
+   *
+   * @param options
+   */
+  @Cordova({
+    successIndex: 1,
+    errorIndex: 2
+  })
+  static numberToString(options:{type:string}) : Promise<{value:string}> {return}
+
+  /**
+   *
+   * @param string
+   * @param options
+   */
+  @Cordova({
+    successIndex: 1,
+    errorIndex: 2
+  })
+  static stringToNumber(string:string, options:{type:string}) :Promise<{value}> {return}
+
+  /**
+   *
+   * @param options
+   */
+  @Cordova({
+    callbackOrder: 'reverse'
+  })
+  static getNumberPattern(options:{type:string}) : Promise<{pattern:string, symbol:string, fraction:number, rounding:number, positive:string, negative:string, decimal:string, grouping:string}> {return}
+
+  /**
+   *
+   * @param currencyCode
+   */
+  @Cordova()
+  static getCurrencyPattern(currencyCode:string) : Promise<{pattern, code, fraction, rounding, decimal, grouping}> {return}
+
+}
\ No newline at end of file
diff --git a/src/plugins/sms.ts b/src/plugins/sms.ts
index 1877cde90..9879d7b85 100644
--- a/src/plugins/sms.ts
+++ b/src/plugins/sms.ts
@@ -40,7 +40,7 @@ export interface smsOptionsAndroid {
 @Plugin({
   plugin: 'cordova-sms-plugin',
   pluginRef: 'sms',
-  repo: 'https://github.com/cordova-sms/cordova-sms-plugin.git'
+  repo: 'https://github.com/cordova-sms/cordova-sms-plugin'
 })
 export class SMS {