aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/index.html4
-rw-r--r--demos/spinner/currency.html6
-rw-r--r--demos/spinner/decimal.html6
-rw-r--r--demos/spinner/time.html4
-rw-r--r--external/jquery.global.de-DE.js (renamed from external/glob.de-DE.js)0
-rw-r--r--external/jquery.global.ja-JP.js (renamed from external/glob.ja-JP.js)0
-rw-r--r--external/jquery.global.js (renamed from external/glob.js)64
-rw-r--r--tests/unit/spinner/spinner.html2
8 files changed, 42 insertions, 44 deletions
diff --git a/demos/index.html b/demos/index.html
index b870221ee..c1efefe73 100644
--- a/demos/index.html
+++ b/demos/index.html
@@ -7,8 +7,8 @@
<link rel="stylesheet" href="demos.css">
<script src="../jquery-1.4.4.js"></script>
<script src="../external/jquery.bgiframe-2.1.2.js"></script>
- <script src="../external/glob.js"></script>
- <script src="../external/glob.de-DE.js"></script>
+ <script src="../external/jquery.global.js"></script>
+ <script src="../external/jquery.global.de-DE.js"></script>
<script src="../ui/jquery.ui.core.js"></script>
<script src="../ui/jquery.ui.widget.js"></script>
<script src="../ui/jquery.ui.mouse.js"></script>
diff --git a/demos/spinner/currency.html b/demos/spinner/currency.html
index 2439674a0..1c2f01a72 100644
--- a/demos/spinner/currency.html
+++ b/demos/spinner/currency.html
@@ -6,9 +6,9 @@
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.4.4.js"></script>
<script type="text/javascript" src="../../external/jquery.mousewheel-3.0.4.js"></script>
- <script type="text/javascript" src="../../external/glob.js"></script>
- <script type="text/javascript" src="../../external/glob.de-DE.js"></script>
- <script type="text/javascript" src="../../external/glob.ja-JP.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.de-DE.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.ja-JP.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
diff --git a/demos/spinner/decimal.html b/demos/spinner/decimal.html
index 6f4b92da1..f396c18d2 100644
--- a/demos/spinner/decimal.html
+++ b/demos/spinner/decimal.html
@@ -6,9 +6,9 @@
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.4.4.js"></script>
<script type="text/javascript" src="../../external/jquery.mousewheel-3.0.4.js"></script>
- <script type="text/javascript" src="../../external/glob.js"></script>
- <script type="text/javascript" src="../../external/glob.de-DE.js"></script>
- <script type="text/javascript" src="../../external/glob.ja-JP.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.de-DE.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.ja-JP.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
diff --git a/demos/spinner/time.html b/demos/spinner/time.html
index e38ee296f..8c5560507 100644
--- a/demos/spinner/time.html
+++ b/demos/spinner/time.html
@@ -6,8 +6,8 @@
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.4.4.js"></script>
<script type="text/javascript" src="../../external/jquery.mousewheel-3.0.4.js"></script>
- <script type="text/javascript" src="../../external/glob.js"></script>
- <script type="text/javascript" src="../../external/glob.de-DE.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.js"></script>
+ <script type="text/javascript" src="../../external/jquery.global.de-DE.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.button.js"></script>
diff --git a/external/glob.de-DE.js b/external/jquery.global.de-DE.js
index d68b84cc8..d68b84cc8 100644
--- a/external/glob.de-DE.js
+++ b/external/jquery.global.de-DE.js
diff --git a/external/glob.ja-JP.js b/external/jquery.global.ja-JP.js
index 454d478cb..454d478cb 100644
--- a/external/glob.ja-JP.js
+++ b/external/jquery.global.ja-JP.js
diff --git a/external/glob.js b/external/jquery.global.js
index 8075ee2bd..fcaacf9c7 100644
--- a/external/glob.js
+++ b/external/jquery.global.js
@@ -1,11 +1,14 @@
-/*
- * Globalization
- * http://github.com/nje/jquery-glob
+/*!
+ * jQuery Globalization Plugin
+ * http://github.com/jquery/jquery-global
+ *
+ * Copyright Software Freedom Conservancy, Inc.
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
*/
(function() {
-var Globalization = {},
- localized = { en: {} };
+var Globalization = {}, localized = { en: {} };
localized["default"] = localized.en;
Globalization.extend = function( deep ) {
@@ -106,10 +109,12 @@ Globalization.preferCulture = function(name) {
this.culture = this.findClosestCulture( name ) || this.cultures["default"];
}
Globalization.localize = function(key, culture, value) {
- if (typeof culture === 'string') {
- culture = culture || "default";
- culture = this.cultures[ culture ] || { name: culture };
+ // usign default culture in case culture is not provided
+ if (typeof culture !== 'string') {
+ culture = this.culture.name || this.culture || "default";
}
+ culture = this.cultures[ culture ] || { name: culture };
+
var local = localized[ culture.name ];
if ( arguments.length === 3 ) {
if ( !local) {
@@ -146,6 +151,9 @@ Globalization.format = function(value, format, culture) {
Globalization.parseInt = function(value, radix, culture) {
return Math.floor( this.parseFloat( value, radix, culture ) );
}
+Globalization.parseCurrency = function(value, culture) {
+ return this.parseFloat(value.replace(/[^\d,.-]/g, ""), 10, culture);
+}
Globalization.parseFloat = function(value, radix, culture) {
culture = this.findClosestCulture( culture );
var ret = NaN,
@@ -297,7 +305,7 @@ var en = cultures["default"] = cultures.en = Globalization.extend(true, {
// And the 'zh-SG' culture is Simplified Chinese in Singapore, whose lanugage
// field is "zh-CHS", not "zh".
// This field should be used to navigate from a specific culture to it's
- // more general, neutral culture. If a culture is already as general as it
+ // more general, neutral culture. If a culture is already as general as it
// can get, the language may refer to itself.
language: "en",
// numberFormat defines general number formatting rules, like the digits in
@@ -307,7 +315,7 @@ var en = cultures["default"] = cultures.en = Globalization.extend(true, {
// Note, numberFormat.pattern has no 'positivePattern' unlike percent and currency,
// but is still defined as an array for consistency with them.
// negativePattern: one of "(n)|-n|- n|n-|n -"
- pattern: ["-n"],
+ pattern: ["-n"],
// number of decimal places normally shown
decimals: 2,
// string that separates number groups, as in 1,000,000
@@ -325,7 +333,7 @@ var en = cultures["default"] = cultures.en = Globalization.extend(true, {
// [negativePattern, positivePattern]
// negativePattern: one of "-n %|-n%|-%n|%-n|%n-|n-%|n%-|-% n|n %-|% n-|% -n|n- %"
// positivePattern: one of "n %|n%|%n|% n"
- pattern: ["-n %","n %"],
+ pattern: ["-n %","n %"],
// number of decimal places normally shown
decimals: 2,
// array of numbers indicating the size of each number group.
@@ -389,7 +397,7 @@ var en = cultures["default"] = cultures.en = Globalization.extend(true, {
},
// AM and PM designators in one of these forms:
// The usual view, and the upper and lower case versions
- // [standard,lowercase,uppercase]
+ // [standard,lowercase,uppercase]
// The culture does not use AM or PM (likely all standard date formats use 24 hour time)
// null
AM: ["AM", "am", "AM"],
@@ -443,7 +451,7 @@ var en = cultures["default"] = cultures.en = Globalization.extend(true, {
Given the date as a parameter, return an array with parts [year, month, day]
corresponding to the non-gregorian based year, month, and day for the calendar.
toGregorian(year, month, day)
- Given the non-gregorian year, month, and day, return a new Date() object
+ Given the non-gregorian year, month, and day, return a new Date() object
set to the corresponding date in the gregorian calendar.
*/
}
@@ -512,7 +520,7 @@ function expandNumber(number, precision, formatInfo) {
rounded = number;
}
number = rounded;
-
+
var numberString = number+"",
right = "",
split = numberString.split(/e/i),
@@ -521,7 +529,7 @@ function expandNumber(number, precision, formatInfo) {
split = numberString.split( "." );
numberString = split[ 0 ];
right = split.length > 1 ? split[ 1 ] : "";
-
+
var l;
if ( exponent > 0 ) {
right = zeroPad( right, exponent, false );
@@ -728,7 +736,7 @@ function getEraYear(date, cal, era, sortable) {
// convert normal gregorian year to era-shifted gregorian
// year by subtracting the era offset
year -= cal.eras[ era ].offset;
- }
+ }
return year;
}
@@ -764,7 +772,7 @@ function getMonthIndex(cal, value, abbr) {
if ( !upperMonths ) {
cal._upperMonths = upperMonths = [
toUpperArray( months.names ),
- toUpperArray( months.namesAbbr ),
+ toUpperArray( months.namesAbbr )
];
cal._upperMonthsGen = upperMonthsGen = [
toUpperArray( monthsGen.names ),
@@ -1153,7 +1161,7 @@ function formatDate(value, format, culture) {
}
return r;
}
-
+
function hasDay() {
if ( foundDay || checkedDay ) {
return foundDay;
@@ -1162,7 +1170,7 @@ function formatDate(value, format, culture) {
checkedDay = true;
return foundDay;
}
-
+
function getPart( date, part ) {
if ( converted ) {
return converted[ part ];
@@ -1197,7 +1205,7 @@ function formatDate(value, format, culture) {
ret.push( ar[ 0 ] );
continue;
}
-
+
var current = ar[ 0 ],
clength = current.length;
@@ -1284,7 +1292,7 @@ function formatDate(value, format, culture) {
// Milliseconds
ret.push( padZeros( value.getMilliseconds(), 3 ).substr( 0, clength ) );
break;
- case "z":
+ case "z":
// Time zone offset, no leading zero
case "zz":
// Time zone offset with leading zero
@@ -1317,17 +1325,7 @@ function formatDate(value, format, culture) {
}
// EXPORTS
-
-window.Globalization = Globalization;
-
-//jQuery.findClosestCulture = Globalization.findClosestCulture;
-//jQuery.culture = Globalization.culture;
-//jQuery.cultures = Globalization.cultures
-//jQuery.preferCulture = Globalization.preferCulture
-//jQuery.localize = Globalization.localize
-//jQuery.format = Globalization.format
-//jQuery.parseInt = Globalization.parseInt
-//jQuery.parseFloat = Globalization.parseFloat
-//jQuery.parseDate = Globalization.parseDate
+jQuery.global = Globalization;
})();
+
diff --git a/tests/unit/spinner/spinner.html b/tests/unit/spinner/spinner.html
index ac90dcf6a..92385669f 100644
--- a/tests/unit/spinner/spinner.html
+++ b/tests/unit/spinner/spinner.html
@@ -7,7 +7,7 @@
<script type="text/javascript" src="../../../jquery-1.4.4.js"></script>
<script type="text/javascript" src="../../../external/jquery.mousewheel-3.0.4.js"></script>
- <script type="text/javascript" src="../../../external/glob.js"></script>
+ <script type="text/javascript" src="../../../external/jquery.global.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../../ui/jquery.ui.button.js"></script>