[SampleApp] Sample application for cordova-plugins-globalization.
authorLukasz Bardeli <l.bardeli@samsung.com>
Wed, 9 Dec 2015 06:13:09 +0000 (07:13 +0100)
committerLukasz Bardeli <l.bardeli@samsung.com>
Wed, 9 Dec 2015 06:13:09 +0000 (07:13 +0100)
Change-Id: I7221f249a3f11793ae3e6a88791c8a752ed181f9
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
14 files changed:
sample/index.html
sample/plugins/globalization/currencyPattern/globalizationCurrencyPattern.html [new file with mode: 0644]
sample/plugins/globalization/currencyPattern/globalizationCurrencyPattern.js [new file with mode: 0644]
sample/plugins/globalization/datePattern/globalizationDatePattern.html [new file with mode: 0644]
sample/plugins/globalization/datePattern/globalizationDatePattern.js [new file with mode: 0644]
sample/plugins/globalization/globalization.css [new file with mode: 0644]
sample/plugins/globalization/globalization.html [new file with mode: 0644]
sample/plugins/globalization/globalization.js [new file with mode: 0644]
sample/plugins/globalization/interconvertDateString/globalizationInterconvertDateString.html [new file with mode: 0644]
sample/plugins/globalization/interconvertDateString/globalizationInterconvertDateString.js [new file with mode: 0644]
sample/plugins/globalization/interconvertNumberString/globalizationInterconvertNumberString.html [new file with mode: 0644]
sample/plugins/globalization/interconvertNumberString/globalizationInterconvertNumberString.js [new file with mode: 0644]
sample/plugins/globalization/numberPattern/globalizationNumberPattern.html [new file with mode: 0644]
sample/plugins/globalization/numberPattern/globalizationNumberPattern.js [new file with mode: 0644]

index 31c4435..fc60e2d 100644 (file)
@@ -43,7 +43,7 @@
                 <a href="plugins/events/index.html" class="button dh"><p>Events</p></a>
                 <a href="#" class="button dh"><p>File</p></a>
                 <a href="#" class="button dh"><p>FileTransfer</p></a>
-                <a href="#" class="button dh"><p>Globalization</p></a>
+                <a href="plugins/globalization/globalization.html"" class="button dh"><p>Globalization</p></a>
                 <a href="plugins/media/media.html" class="button dh"><p>Media</p></a>
                 <a href="plugins/networkInformation/connection.html" class="button dh"><p>Network Information</p></a>
             </div>
diff --git a/sample/plugins/globalization/currencyPattern/globalizationCurrencyPattern.html b/sample/plugins/globalization/currencyPattern/globalizationCurrencyPattern.html
new file mode 100644 (file)
index 0000000..da71e39
--- /dev/null
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<!--
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+-->
+<html>
+    <head>
+        <title>Globalization - Currency Pattern</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
+        <link rel="stylesheet" type="text/css" href="../globalization.css" />
+        <script type="text/javascript" src="../../../lib/cordova.js"></script>
+        <script src="../../../js/SimpleLogger.js"></script>
+        <script src="globalizationCurrencyPattern.js"></script>
+    </head>
+    <body>
+        <header class="header">
+            <h1>Date Pattern</h1>
+        </header>
+        <div class="content">
+            <div class="action-area ch30">
+                <div class="actions">
+                    Currency code:
+                    <select id="selector-currencyCode">
+                      <option value="USD">USD</option>
+                      <option value="EUR">EUR</option>
+                      <option value="KRW">KRW</option>
+                      <option value="CHF">CHF</option>
+                      <option value="GBP">GBP</option>
+                      <option value="INR">INR</option>
+                      <option value="AUD">AUD</option>
+                    </select>
+                </div>
+            </div>
+            <div class="result-area ch70">
+                <div class="results">
+                    <div class="result-info">
+                        <div id="messageResult"></div>
+                        <div class="clear"></div>
+                    </div>
+                </div>
+                <div class="separator"></div>
+            </div>
+        </div>
+    </body>
+    <footer class="footer">
+        <div>Cordova API Samples</div>
+    </footer>
+</html>
\ No newline at end of file
diff --git a/sample/plugins/globalization/currencyPattern/globalizationCurrencyPattern.js b/sample/plugins/globalization/currencyPattern/globalizationCurrencyPattern.js
new file mode 100644 (file)
index 0000000..5672f0d
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+
+(function() {
+  var info;
+  function updateInfo(msg) {
+    info.innerHTML = msg;
+  }
+
+  function clearInfo() {
+    updateInfo('');
+  }
+
+  function getCurrencyPattern() {
+    info.innerHTML = 'Please wait ...';
+    var c = document.getElementById('selector-currencyCode').value;
+    navigator.globalization.getCurrencyPattern(c,
+        function (pattern) { info.innerHTML = 'pattern : ' + pattern.pattern + '</br>' +
+                                           'code : ' + pattern.code + '</br>' +
+                                           'fraction : ' + pattern.fraction + '</br>' +
+                                           'rounding : ' + pattern.rounding + '</br>' +
+                                           'decimal : ' + pattern.decimal + '</br>' +
+                                           'grouping : ' + pattern.grouping + '</br>'; },
+        function (e) { info.innerHTML = 'Error while getting date pattern '+ e.name; }
+    );
+  }
+
+  var action = {
+    'currencyCode' : function() {
+      getCurrencyPattern();
+    }
+  }
+
+  function onDeviceReady() {
+    document.addEventListener('backbutton', function() {
+      window.history.back();
+    });
+
+    for (var a in action) {
+      if (action.hasOwnProperty(a)) {
+        var x = document.getElementById('selector-' + a);
+        if (x) {
+          x.addEventListener('change', action[a]);
+        }
+      }
+    }
+  }
+
+  document.addEventListener('deviceready', onDeviceReady, false);
+
+  window.onload = function() {
+    info = document.getElementById('messageResult');
+    getCurrencyPattern();
+  }
+})();
\ No newline at end of file
diff --git a/sample/plugins/globalization/datePattern/globalizationDatePattern.html b/sample/plugins/globalization/datePattern/globalizationDatePattern.html
new file mode 100644 (file)
index 0000000..707a763
--- /dev/null
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<!--
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+-->
+<html>
+    <head>
+        <title>Globalization - Date Pattern</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
+        <link rel="stylesheet" type="text/css" href="../globalization.css" />
+        <script type="text/javascript" src="../../../lib/cordova.js"></script>
+        <script src="../../../js/SimpleLogger.js"></script>
+        <script src="globalizationDatePattern.js"></script>
+    </head>
+    <body>
+        <header class="header">
+            <h1>Date Pattern</h1>
+        </header>
+        <div class="content">
+            <div class="action-area ch30">
+                <div class="actions">
+                    Format length:
+                    <select id="selector-format">
+                      <option value="short">short</option>
+                      <option value="medium">medium</option>
+                      <option value="long">long</option>
+                      <option value="full">full</option>
+                    </select>
+                </div>
+                <div class="actions">
+                    Selector:
+                    <select id="selector-selector">
+                      <option value="date">date</option>
+                      <option value="time">time</option>
+                      <option value="date and time">date and time</option>
+                    </select>
+                </div>
+            </div>
+            <div class="result-area ch70">
+                <div class="results">
+                    <div class="result-info">
+                        <div id="messageResult"></div>
+                        <div class="clear"></div>
+                    </div>
+                </div>
+                <div class="separator"></div>
+            </div>
+        </div>
+    </body>
+    <footer class="footer">
+        <div>Cordova API Samples</div>
+    </footer>
+</html>
\ No newline at end of file
diff --git a/sample/plugins/globalization/datePattern/globalizationDatePattern.js b/sample/plugins/globalization/datePattern/globalizationDatePattern.js
new file mode 100644 (file)
index 0000000..2efe4a3
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+
+(function() {
+  var info;
+  function updateInfo(msg) {
+    info.innerHTML = msg;
+  }
+
+  function clearInfo() {
+    updateInfo('');
+  }
+
+  function getDatePattern() {
+    info.innerHTML = 'Please wait ...';
+    var f = document.getElementById('selector-format').value;
+    var s = document.getElementById('selector-selector').value;
+
+    navigator.globalization.getDatePattern(
+        function (date) { info.innerHTML = 'pattern : ' + date.pattern + '</br>' +
+                                           'timezone : ' + date.timezone + '</br>' +
+                                           'utc_offset : ' + date.utc_offset + '</br>' +
+                                           'dst_offset : ' + date.dst_offset + '</br>'; },
+        function (e) { info.innerHTML = 'Error while getting date pattern '+ e.name; },
+        { formatLength: f, selector: s }
+    );
+  }
+
+  var action = {
+    'format' : function() {
+      getDatePattern();
+    },
+    'selector' : function() {
+      getDatePattern();
+    }
+  }
+
+  function onDeviceReady() {
+    document.addEventListener('backbutton', function() {
+      window.history.back();
+    });
+
+    for (var a in action) {
+      if (action.hasOwnProperty(a)) {
+        var x = document.getElementById('selector-' + a);
+        if (x) {
+          x.addEventListener('change', action[a]);
+        }
+      }
+    }
+  }
+
+  document.addEventListener('deviceready', onDeviceReady, false);
+
+  window.onload = function() {
+    info = document.getElementById('messageResult');
+    getDatePattern();
+  }
+})();
\ No newline at end of file
diff --git a/sample/plugins/globalization/globalization.css b/sample/plugins/globalization/globalization.css
new file mode 100644 (file)
index 0000000..6b5f0b7
--- /dev/null
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+/* apply a natural box layout model to all elements */
+* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }
+
+html
+{
+    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+    height:100%;
+}
+
+body
+{
+    font-family: sans-serif, Arial, Segoe UI;
+    font-size: 16px;
+    margin: 0;
+    padding: 0;
+    height:100%;
+    padding: 60px 0px 24px 0px;
+    overflow:hidden;
+}
+
+/*width, height*/
+.clear {clear:both;}
+
+.ch10 {height:10%;}
+.ch20 {height:20%;}
+.ch30 {height:30%;}
+.ch40 {height:40%;}
+.ch50 {height:50%;}
+.ch60 {height:60%;}
+.ch70 {height:70%;}
+.ch80 {height:80%;}
+.ch90 {height:90%;}
+.ch100 {height:100%;}
+
+.cw10 {width:10%;}
+.cw20 {width:20%;}
+.cw30 {width:30%;}
+.cw40 {width:40%;}
+.cw50 {width:50%;}
+.cw60 {width:60%;}
+.cw70 {width:70%;}
+.cw80 {width:80%;}
+.cw90 {width:90%;}
+.cw100 {width:100%;}
+
+/*header*/
+.header
+{
+    position:absolute;
+    top: 0px;
+    left:0px;
+    width:100%;
+    height: 60px;
+    border:none;
+    background: #dedfe1;
+    background: -moz-linear-gradient(top, #ffffff 0%, #e6e6e6 100%);
+    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e6e6e6));
+    background: -webkit-linear-gradient(top, #ffffff 0%,#e6e6e6 100%);
+    background: -o-linear-gradient(top, #ffffff 0%,#e6e6e6 100%);
+    background: -ms-linear-gradient(top, #ffffff 0%,#e6e6e6 100%);
+    background: linear-gradient(to bottom, #ffffff 0%,#e6e6e6 100%);
+    box-shadow: 0px 1px 0px 0px #fff;
+    -webkit-box-shadow: 0px 1px 0px 0px #fff;
+    -moz-box-shadow: 0px 1px 0px 0px #fff;
+    border-bottom: 1px solid #9ca1a5;
+    color: #639ecd;
+}
+.header > h1
+{
+    font-size: 30px;
+    font-weight: normal;
+    border-bottom: 4px solid #639ecd;
+    display: inline-block;
+    margin: 0 0 0 12px;
+    position:absolute;
+    bottom:0;
+    text-shadow: 0 1px 0 #fff;
+}
+
+/*content*/
+.content
+{
+    background:#f0f0f0;
+    min-height:100%;
+    height:100%;
+    overflow:hidden;
+}
+
+.content > .input-area,
+.content > .action-area,
+.content > .result-area {
+    width: 100%;
+    border-top: 1px solid #9ca1a5;
+    position:relative;
+}
+.content > .input-area,
+.content > .action-area {
+    border-top-color:#fff;
+}
+.content > .input-area.ch100,
+.content > .action-areach100,
+.content > .result-area.ch100 {
+    border-top-color:transparent;
+}
+
+.content > .input-area > .inputBox {
+    background-color: #fff;
+    font-style: italic;
+    color: #A7A7A7;
+    width: 290px;
+    padding: 7px 10px;
+    border-radius: 3px;
+    border-width: 1px;
+    border-style: solid;
+    border-color: rgb(180, 180, 180);
+    border-bottom-color: rgb(255, 255, 255);
+    box-shadow: 0 -1px 0 #3C3C3C;
+    margin-left:12px;
+    margin-top:10px;
+}
+.content > .input-area {
+    background-color:#e4e4e4;
+}
+
+
+.content > .action-area > .actions {
+    margin:20px;
+    font-size:12px;
+    color:#a7a9ad;
+    margin-top:20px;
+    text-align:center;
+}
+
+.content > .result-area > .results {
+    margin:20px;
+}
+
+.content > .result-area > .results  > .desc {
+    font-size:12px;
+    color:#a7a9ad;
+    margin-top:20px;
+    text-align:center;
+}
+
+.content > .result-area > .results > .result-info > div:first-of-type {
+    color:#a7a9ad;
+    font-size:20px;
+    float:left;
+    text-align:right;
+    text-shadow: 0 1px 0 #fff;
+}
+.content > .result-area > .results > .result-info > div:first-of-type + div {
+    color:#414349;
+    font-size:20px;
+    margin-left:10px;
+    float:left;
+    text-shadow: 0 1px 0 #fff;
+}
+
+/*separator*/
+.content > .result-area > .separator
+{
+    height: 12px;
+    border: none;
+    background: -moz-linear-gradient(top, rgba(227, 227, 227, 1) 0%, rgba(240, 240, 240, 1) 100%);
+    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(227, 227, 227, 1)), color-stop(100%, rgba(240, 240, 240, 1)));
+    background: -webkit-linear-gradient(top, rgba(227, 227, 227, 1) 0%, rgba(240, 240, 240, 1) 100%);
+    background: -o-linear-gradient(top, rgba(227, 227, 227, 1) 0%, rgba(240, 240, 240, 1) 100%);
+    background: -ms-linear-gradient(top, rgba(227, 227, 227, 1) 0%, rgba(240, 240, 240, 1) 100%);
+    background: linear-gradient(to bottom, rgba(227, 227, 227, 1) 0%, rgba(240, 240, 240, 1) 100%);
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    right: 0px;
+    margin: 1px;
+}
+
+/*footer*/
+.footer
+{
+    position:fixed;
+    bottom: 0px;
+    left:0px;
+    width:100%;
+    height: 24px;
+    background:#5f626a;
+    border-top:1px solid #42444a;
+    box-shadow: inset 0px 1px 7px 0px rgba(0,0,0,0.5);
+    -webkit-box-shadow: inset 0px 1px 7px 0px rgba(0,0,0,0.5);
+    -moz-box-shadow: inset 0px 1px 7px 0px rgba(0,0,0,0.5);
+}
+.footer:before
+{
+    position: relative;
+    left: 12px;
+    top:2px;
+}
+
+.footer div
+{
+    position:absolute;
+    right:12px;
+    top:4px;;
+    color: #afb1b5;
+    font-size:14px;
+}
+
+/*button*/
+.button
+{
+    border: 1px solid #8d9096;
+    border-radius: 3px;
+    color: #4d5d6b;
+    background: transparent;
+    margin-left:12px;
+    margin-top:12px;
+    width: 140px;
+    height: 32px;
+    display: inline;
+    float: left;
+}
+
+.button:active
+{
+    border: 1px solid #639ecd;
+    background-image: none;
+    background-color: #639ecd;
+    color: #fff;
+    box-shadow: inset 0px 1px 1px 0px rgba(0,0,0,0.3);
+    -webkit-box-shadow: inset 0px 1px 1px 0px rgba(0,0,0,0.3);
+    -moz-box-shadow: inset 0px 1px 1px 0px rgba(0,0,0,0.3);
+}
+
+.button:disabled,
+.button:disabled:hover,
+.button:disabled:active
+{
+    background: rgba(49, 52, 55, 0.1);
+    color: rgba(255, 255, 255, 0.5);
+    border: 1px solid rgba(255, 255, 255, 0.5);
+}
+.button.dh {
+    height:60px;
+}
+.button.dw {
+    width:220px;
+}
+
+/* landscape */
+@media screen and (orientation:landscape) {
+    .button.dh {
+        height:32px;
+        width:220px;
+    }
+}
\ No newline at end of file
diff --git a/sample/plugins/globalization/globalization.html b/sample/plugins/globalization/globalization.html
new file mode 100644 (file)
index 0000000..8828c67
--- /dev/null
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<!--
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+-->
+<html>
+    <head>
+        <title>Globalization Sample App</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <link rel="stylesheet" type="text/css" href="../../css/style.css" />
+        <link rel="stylesheet" type="text/css" href="globalization.css" />
+        <script type="text/javascript" src="../../lib/cordova.js"></script>
+        <script src="../../js/SimpleLogger.js"></script>
+        <script src="globalization.js"></script>
+    </head>
+    <body>
+        <header class="header">
+            <h1>Globalization</h1>
+        </header>
+        <div class="content">
+            <div class="action-area ch70">
+                <button class="button dh" id="button-localeInformation">Locale Information</button>
+                <button class="button dh" id="button-datePattern">Date Pattern</button>
+                <button class="button dh" id="button-numberPattern">Number Pattern</button>
+                <button class="button dh" id="button-currencyPattern">Currency Pattern</button>
+                <button class="button dh" id="button-interconvertNumberString">Interconvert number & string
+                <button class="button dh" id="button-interconvertDateString">Interconvert date & string
+</button>
+            </div>
+            <div class="result-area ch30">
+                <div class="results">
+                    <div class="result-info">
+                        <div id="messageResult"></div>
+                        <div class="clear"></div>
+                    </div>
+                </div>
+                <div class="separator"></div>
+            </div>
+        </div>
+    </body>
+    <footer class="footer">
+        <div>Cordova API Samples</div>
+    </footer>
+</html>
\ No newline at end of file
diff --git a/sample/plugins/globalization/globalization.js b/sample/plugins/globalization/globalization.js
new file mode 100644 (file)
index 0000000..78586ee
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+
+(function() {
+  var info;
+  function updateInfo(msg) {
+    info.innerHTML = msg;
+  }
+
+  function clearInfo() {
+    updateInfo('');
+  }
+
+  var action = {
+    'localeInformation' : function() {
+      navigator.globalization.getLocaleName(
+          function (locale) {info.innerHTML = 'Locale: '+ locale.value;},
+          function (e) {info.innerHTML = 'Error while getting locale '+ e.name;}
+      );
+    },
+    'datePattern' : function() {
+      window.location.href = 'datePattern/globalizationDatePattern.html';
+    },
+    'showDatePattern' : function() {
+      alert(document.getElementById('format-selector').value)
+    },
+    'numberPattern' : function() {
+      window.location.href = 'numberPattern/globalizationNumberPattern.html';
+    },
+    'currencyPattern' : function() {
+      window.location.href = 'currencyPattern/globalizationCurrencyPattern.html';
+    },
+    'interconvertNumberString' : function() {
+      window.location.href = 'interconvertNumberString/globalizationInterconvertNumberString.html';
+    },
+    'interconvertDateString' : function() {
+      window.location.href = 'interconvertDateString/globalizationInterconvertDateString.html';
+    }
+  }
+
+  function onDeviceReady() {
+    document.addEventListener('backbutton', function() {
+      window.history.back();
+    });
+
+    for (var a in action) {
+      if (action.hasOwnProperty(a)) {
+        var x = document.getElementById('button-' + a);
+        if (x) {
+          x.addEventListener('click', action[a]);
+        }
+      }
+    }
+  }
+
+  document.addEventListener('deviceready', onDeviceReady, false);
+
+  window.onload = function() {
+    info = document.getElementById('messageResult');
+  }
+})();
\ No newline at end of file
diff --git a/sample/plugins/globalization/interconvertDateString/globalizationInterconvertDateString.html b/sample/plugins/globalization/interconvertDateString/globalizationInterconvertDateString.html
new file mode 100644 (file)
index 0000000..ed37ffe
--- /dev/null
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<!--
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+-->
+<html>
+    <head>
+        <title>Globalization - Interconvert Date And String</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
+        <link rel="stylesheet" type="text/css" href="../globalization.css" />
+        <script type="text/javascript" src="../../../lib/cordova.js"></script>
+        <script src="../../../js/SimpleLogger.js"></script>
+        <script src="globalizationInterconvertDateString.js"></script>
+    </head>
+    <body>
+        <header class="header">
+            <h1>Interconvert Date And String</h1>
+        </header>
+        <div class="content">
+            <div class="action-area ch50">
+                <div class="actions">
+                    Date <input type="text" id="interconvertDate" /> </br>
+                    String <input type="text" id="interconvertString" /> </br>
+                    <div class="actions">
+                        Format length:
+                        <select id="selector-format">
+                          <option value="short">short</option>
+                          <option value="medium">medium</option>
+                          <option value="long">long</option>
+                          <option value="full">full</option>
+                        </select>
+                    </div>
+                    <div class="actions">
+                        Selector:
+                        <select id="selector-selector">
+                          <option value="date">date</option>
+                          <option value="time">time</option>
+                          <option value="date and time">date and time</option>
+                        </select>
+                    </div>
+                    <button class="button dh" id="button-Date">To Date</button>
+                    <button class="button dh" id="button-String">To String</button>
+                </div>
+            </div>
+            <div class="result-area ch50">
+                <div class="results">
+                    <div class="result-info">
+                        <div id="messageResult"></div>
+                        <div class="clear"></div>
+                    </div>
+                </div>
+                <div class="separator"></div>
+            </div>
+        </div>
+    </body>
+    <footer class="footer">
+        <div>Cordova API Samples</div>
+    </footer>
+</html>
\ No newline at end of file
diff --git a/sample/plugins/globalization/interconvertDateString/globalizationInterconvertDateString.js b/sample/plugins/globalization/interconvertDateString/globalizationInterconvertDateString.js
new file mode 100644 (file)
index 0000000..6874459
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+
+(function() {
+  var info;
+  function updateInfo(msg) {
+    info.innerHTML = msg;
+  }
+
+  function clearInfo() {
+    updateInfo('');
+  }
+
+  function checkIfEmpty(type) {
+    if ('' == document.getElementById('interconvert'+type).value) {
+      return true;
+    }
+    return false;
+  }
+
+  function convertToString() {
+    info.innerHTML = 'Please wait ...';
+    var f = document.getElementById('selector-format').value;
+    var s = document.getElementById('selector-selector').value;
+    var n = new Date(document.getElementById('interconvertDate').value);
+
+    navigator.globalization.dateToString(n,
+        function (date) {
+          document.getElementById('interconvertString').value = date.value;
+          clearInfo();
+          info.innerHTML = 'String ' + document.getElementById('interconvertDate').value +
+          ' convert to String ' + date.value;
+        },
+        function (e) { info.innerHTML = 'Error while convert to String '+ e.name; },
+        { formatLength: f, selector: s }
+    );
+  }
+
+  function convertToDate() {
+    info.innerHTML = 'Please wait ...';
+    var f = document.getElementById('selector-format').value;
+    var s = document.getElementById('selector-selector').value;
+    var n = document.getElementById('interconvertString').value;
+
+    navigator.globalization.stringToDate(n,
+        function (date) {
+          clearInfo();
+          info.innerHTML = 'String ' + document.getElementById('interconvertString').value +
+          ' convert to Date </br> month: ' + date.month +
+          '</br> day: ' + date.day +
+          '</br> year: ' + date.year +
+          '</br> hour: ' + date.hour +
+          '</br> minute: ' + date.minute +
+          '</br> second: ' + date.second +
+          '</br> millisecond: ' + date.millisecond;
+        } ,
+        function (e) { info.innerHTML = 'Error while convert to Date '+ e.name; },
+        { formatLength: f, selector: s }
+    );
+  }
+
+  var action = {
+    'Date' : function() {
+      if (checkIfEmpty('String')) {
+        alert('String field is empty!')
+      } else {
+        convertToDate();
+      }
+    },
+    'String' : function() {
+      if (checkIfEmpty('Date')) {
+        alert('Date field is empty!')
+      } else {
+        convertToString();
+      }
+    }
+  }
+
+  function onDeviceReady() {
+    document.addEventListener('backbutton', function() {
+      window.history.back();
+    });
+
+    for (var a in action) {
+      if (action.hasOwnProperty(a)) {
+        var x = document.getElementById('button-' + a);
+        if (x) {
+          x.addEventListener('click', action[a]);
+        }
+      }
+    }
+  }
+
+  document.addEventListener('deviceready', onDeviceReady, false);
+
+  window.onload = function() {
+    info = document.getElementById('messageResult');
+    document.getElementById('interconvertDate').value = new Date();
+  }
+})();
\ No newline at end of file
diff --git a/sample/plugins/globalization/interconvertNumberString/globalizationInterconvertNumberString.html b/sample/plugins/globalization/interconvertNumberString/globalizationInterconvertNumberString.html
new file mode 100644 (file)
index 0000000..52d1836
--- /dev/null
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<!--
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+-->
+<html>
+    <head>
+        <title>Globalization - Interconvert Number And String</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
+        <link rel="stylesheet" type="text/css" href="../globalization.css" />
+        <script type="text/javascript" src="../../../lib/cordova.js"></script>
+        <script src="../../../js/SimpleLogger.js"></script>
+        <script src="globalizationInterconvertNumberString.js"></script>
+    </head>
+    <body>
+        <header class="header">
+            <h1>Interconvert Number And String</h1>
+        </header>
+        <div class="content">
+            <div class="action-area ch60">
+                <div class="actions">
+                    Number <input type="text" id="interconverNumber" value="1000" /> </br>
+                    String <input type="text" id="interconverString" /> </br>
+                    <div class="actions">
+                        Type:
+                        <select id="selector-type">
+                          <option value="decimal">decimal</option>
+                          <option value="percent">percent</option>
+                          <option value="currency">currency</option>
+                        </select>
+                    </div>
+                    <button class="button dh" id="button-Number">To Number</button>
+                    <button class="button dh" id="button-String">To String</button>
+                </div>
+            </div>
+            <div class="result-area ch40">
+                <div class="results">
+                    <div class="result-info">
+                        <div id="messageResult"></div>
+                        <div class="clear"></div>
+                    </div>
+                </div>
+                <div class="separator"></div>
+            </div>
+        </div>
+    </body>
+    <footer class="footer">
+        <div>Cordova API Samples</div>
+    </footer>
+</html>
\ No newline at end of file
diff --git a/sample/plugins/globalization/interconvertNumberString/globalizationInterconvertNumberString.js b/sample/plugins/globalization/interconvertNumberString/globalizationInterconvertNumberString.js
new file mode 100644 (file)
index 0000000..e9f7494
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+
+(function() {
+  var info;
+  function updateInfo(msg) {
+    info.innerHTML = msg;
+  }
+
+  function clearInfo() {
+    updateInfo('');
+  }
+
+  function checkIfEmpty(type) {
+    if ('' == document.getElementById('interconver'+type).value) {
+      return true;
+    }
+    return false;
+  }
+
+  function convertToString() {
+    info.innerHTML = 'Please wait ...';
+    var t = document.getElementById('selector-type').value;
+    var n = Number(document.getElementById('interconverNumber').value);
+
+    navigator.globalization.numberToString(n,
+        function (number) {
+          document.getElementById('interconverString').value = number.value;
+          clearInfo();
+        },
+        function (e) { info.innerHTML = 'Error while convert to String '+ e.name; },
+        {type : t}
+    );
+  }
+
+  function convertToNumber() {
+    info.innerHTML = 'Please wait ...';
+    var t = document.getElementById('selector-type').value;
+    var n = document.getElementById('interconverString').value;
+
+    navigator.globalization.stringToNumber(n,
+        function (number) {
+          document.getElementById('interconvertNumber').value = number.value;
+          clearInfo()
+        },
+        function (e) { info.innerHTML = 'Error while convert to Number '+ e.name; },
+        {type : t}
+    );
+  }
+
+  var action = {
+    'Number' : function() {
+      if (checkIfEmpty('String')) {
+        alert('String field is empty!')
+      } else {
+        convertToNumber();
+      }
+    },
+    'String' : function() {
+      if (checkIfEmpty('Number')) {
+        alert('Number field is empty!')
+      } else {
+        convertToString();
+      }
+    }
+  }
+
+  function onDeviceReady() {
+    document.addEventListener('backbutton', function() {
+      window.history.back();
+    });
+
+    for (var a in action) {
+      if (action.hasOwnProperty(a)) {
+        var x = document.getElementById('button-' + a);
+        if (x) {
+          x.addEventListener('click', action[a]);
+        }
+      }
+    }
+  }
+
+  document.addEventListener('deviceready', onDeviceReady, false);
+
+  window.onload = function() {
+    info = document.getElementById('messageResult');
+  }
+})();
\ No newline at end of file
diff --git a/sample/plugins/globalization/numberPattern/globalizationNumberPattern.html b/sample/plugins/globalization/numberPattern/globalizationNumberPattern.html
new file mode 100644 (file)
index 0000000..8be8773
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<!--
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+-->
+<html>
+    <head>
+        <title>Globalization - Number Pattern</title>
+        <meta charset="UTF-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <link rel="stylesheet" type="text/css" href="../../../css/style.css" />
+        <link rel="stylesheet" type="text/css" href="../globalization.css" />
+        <script type="text/javascript" src="../../../lib/cordova.js"></script>
+        <script src="../../../js/SimpleLogger.js"></script>
+        <script src="globalizationNumberPattern.js"></script>
+    </head>
+    <body>
+        <header class="header">
+            <h1>Number Pattern</h1>
+        </header>
+        <div class="content">
+            <div class="action-area ch30">
+                <div class="actions">
+                    Type:
+                    <select id="selector-type">
+                      <option value="decimal">decimal</option>
+                      <option value="percent">percent</option>
+                      <option value="currency">currency</option>
+                    </select>
+                </div>
+            </div>
+            <div class="result-area ch70">
+                <div class="results">
+                    <div class="result-info">
+                        <div id="messageResult"></div>
+                        <div class="clear"></div>
+                    </div>
+                </div>
+                <div class="separator"></div>
+            </div>
+        </div>
+    </body>
+    <footer class="footer">
+        <div>Cordova API Samples</div>
+    </footer>
+</html>
\ No newline at end of file
diff --git a/sample/plugins/globalization/numberPattern/globalizationNumberPattern.js b/sample/plugins/globalization/numberPattern/globalizationNumberPattern.js
new file mode 100644 (file)
index 0000000..43d5277
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014-2015 Telerik AD
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed 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.
+ */
+
+(function() {
+  var info;
+  function updateInfo(msg) {
+    info.innerHTML = msg;
+  }
+
+  function clearInfo() {
+    updateInfo('');
+  }
+
+  function getNumberPattern() {
+    info.innerHTML = 'Please wait ...';
+    var t = document.getElementById('selector-type').value;
+    navigator.globalization.getNumberPattern(
+        function (pattern) { info.innerHTML = 'pattern : ' + pattern.pattern + '</br>' +
+                                           'symbol : ' + pattern.symbol + '</br>' +
+                                           'fraction : ' + pattern.fraction + '</br>' +
+                                           'rounding : ' + pattern.rounding + '</br>' +
+                                           'positive : ' + pattern.positive + '</br>' +
+                                           'negative : ' + pattern.negative + '</br>' +
+                                           'decimal : ' + pattern.decimal + '</br>' +
+                                           'grouping : ' + pattern.grouping + '</br>'; },
+        function (e) { info.innerHTML = 'Error while getting number pattern '+ e.name; },
+        { type: t }
+    );
+  }
+
+  var action = {
+    'type' : function() {
+      getNumberPattern();
+    }
+  }
+
+  function onDeviceReady() {
+    document.addEventListener('backbutton', function() {
+      window.history.back();
+    });
+
+    for (var a in action) {
+      if (action.hasOwnProperty(a)) {
+        var x = document.getElementById('selector-' + a);
+        if (x) {
+          x.addEventListener('change', action[a]);
+        }
+      }
+    }
+  }
+
+  document.addEventListener('deviceready', onDeviceReady, false);
+
+  window.onload = function() {
+    info = document.getElementById('messageResult');
+    getNumberPattern();
+  }
+})();
\ No newline at end of file