Replace $.global with Globalize, update Spinner to use it. Related demos currently broken due to previous changes.

This commit is contained in:
Jörn Zaefferer 2011-08-10 14:55:16 +02:00
parent bb79b41871
commit 56e9cd7119
10 changed files with 1773 additions and 1489 deletions

View File

@ -6,9 +6,9 @@
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.6.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.global.js"></script>
<script src="../../external/jquery.global.de-DE.js"></script>
<script src="../../external/jquery.global.ja-JP.js"></script>
<script src="../../external/globalize.js"></script>
<script src="../../external/globalize.culture.de-DE.js"></script>
<script src="../../external/globalize.culture.ja-JP.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
@ -18,7 +18,7 @@
$(function() {
$( "#currency" ).change(function() {
var current = $( "#spinner" ).spinner( "value" );
$.global.preferCulture( $(this).val() );
Globalize.culture( $(this).val() );
$( "#spinner" ).spinner( "value", current );
});
@ -28,7 +28,7 @@
step: 25,
start: 1000,
numberFormat: "C"
});
});
});
</script>
</head>
@ -42,7 +42,7 @@
<option value="en-US">US $</option>
<option value="de-DE">EUR €</option>
<option value="ja-JP">YEN ¥</option>
</select>
</select>
</p>
<p>
<label for="spinner">Amount to donate:</label>

View File

@ -6,9 +6,9 @@
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.6.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.global.js"></script>
<script src="../../external/jquery.global.de-DE.js"></script>
<script src="../../external/jquery.global.ja-JP.js"></script>
<script src="../../external/globalize.js"></script>
<script src="../../external/globalize.culture.de-DE.js"></script>
<script src="../../external/globalize.culture.ja-JP.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
@ -19,11 +19,11 @@
$( "#spinner" ).spinner({
step: 0.01,
numberFormat: "n"
});
});
$( "#culture" ).change(function() {
var current = $( "#spinner" ).spinner( "value" );
$.global.preferCulture( $(this).val() );
Globalize.culture( $(this).val() );
$( "#spinner" ).spinner( "value", current );
});
});

View File

@ -6,8 +6,8 @@
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.6.2.js"></script>
<script src="../../external/jquery.mousewheel-3.0.4.js"></script>
<script src="../../external/jquery.global.js"></script>
<script src="../../external/jquery.global.de-DE.js"></script>
<script src="../../external/globalize.js"></script>
<script src="../../external/globalize.culture.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.button.js"></script>
@ -24,13 +24,13 @@
_parse: function( value ) {
if ( typeof value === "string" ) {
return +$.global.parseDate( value );
return +Globalize.parseDate( value );
}
return value;
},
_format: function() {
this.element.val( $.global.format( new Date(this.options.value), "t" ) );
this.element.val( Globalize.format( new Date(this.options.value), "t" ) );
}
});
@ -39,7 +39,7 @@
$( "#culture" ).change(function() {
var current = $( "#spinner" ).timespinner( "value" );
$.global.preferCulture( $(this).val() );
Globalize.culture( $(this).val() );
$( "#spinner" ).timespinner( "value", current );
});
});

81
external/globalize.culture.de-DE.js vendored Normal file
View File

@ -0,0 +1,81 @@
/*
* Globalize Culture de-DE
*
* http://github.com/jquery/globalize
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this file need to be fixed in the generator
*/
(function( window, undefined ) {
var Globalize;
if ( typeof require !== "undefined"
&& typeof exports !== "undefined"
&& typeof module !== "undefined" ) {
// Assume CommonJS
Globalize = require( "globalize" );
} else {
// Global variable
Globalize = window.Globalize;
}
Globalize.addCultureInfo( "de-DE", "default", {
name: "de-DE",
englishName: "German (Germany)",
nativeName: "Deutsch (Deutschland)",
language: "de",
numberFormat: {
",": ".",
".": ",",
NaN: "n. def.",
negativeInfinity: "-unendlich",
positiveInfinity: "+unendlich",
percent: {
pattern: ["-n%","n%"],
",": ".",
".": ","
},
currency: {
pattern: ["-n $","n $"],
",": ".",
".": ",",
symbol: "€"
}
},
calendars: {
standard: {
"/": ".",
firstDay: 1,
days: {
names: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],
namesAbbr: ["So","Mo","Di","Mi","Do","Fr","Sa"],
namesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"]
},
months: {
names: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],
namesAbbr: ["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""]
},
AM: null,
PM: null,
eras: [{"name":"n. Chr.","start":null,"offset":0}],
patterns: {
d: "dd.MM.yyyy",
D: "dddd, d. MMMM yyyy",
t: "HH:mm",
T: "HH:mm:ss",
f: "dddd, d. MMMM yyyy HH:mm",
F: "dddd, d. MMMM yyyy HH:mm:ss",
M: "dd MMMM",
Y: "MMMM yyyy"
}
}
}
});
}( this ));

100
external/globalize.culture.ja-JP.js vendored Normal file
View File

@ -0,0 +1,100 @@
/*
* Globalize Culture ja-JP
*
* http://github.com/jquery/globalize
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* This file was generated by the Globalize Culture Generator
* Translation: bugs found in this file need to be fixed in the generator
*/
(function( window, undefined ) {
var Globalize;
if ( typeof require !== "undefined"
&& typeof exports !== "undefined"
&& typeof module !== "undefined" ) {
// Assume CommonJS
Globalize = require( "globalize" );
} else {
// Global variable
Globalize = window.Globalize;
}
Globalize.addCultureInfo( "ja-JP", "default", {
name: "ja-JP",
englishName: "Japanese (Japan)",
nativeName: "日本語 (日本)",
language: "ja",
numberFormat: {
NaN: "NaN (非数値)",
negativeInfinity: "-∞",
positiveInfinity: "+∞",
percent: {
pattern: ["-n%","n%"]
},
currency: {
pattern: ["-$n","$n"],
decimals: 0,
symbol: "¥"
}
},
calendars: {
standard: {
days: {
names: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],
namesAbbr: ["日","月","火","水","木","金","土"],
namesShort: ["日","月","火","水","木","金","土"]
},
months: {
names: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",""],
namesAbbr: ["1","2","3","4","5","6","7","8","9","10","11","12",""]
},
AM: ["午前","午前","午前"],
PM: ["午後","午後","午後"],
eras: [{"name":"西暦","start":null,"offset":0}],
patterns: {
d: "yyyy/MM/dd",
D: "yyyy'年'M'月'd'日'",
t: "H:mm",
T: "H:mm:ss",
f: "yyyy'年'M'月'd'日' H:mm",
F: "yyyy'年'M'月'd'日' H:mm:ss",
M: "M'月'd'日'",
Y: "yyyy'年'M'月'"
}
},
Japanese: {
name: "Japanese",
days: {
names: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],
namesAbbr: ["日","月","火","水","木","金","土"],
namesShort: ["日","月","火","水","木","金","土"]
},
months: {
names: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",""],
namesAbbr: ["1","2","3","4","5","6","7","8","9","10","11","12",""]
},
AM: ["午前","午前","午前"],
PM: ["午後","午後","午後"],
eras: [{"name":"平成","start":null,"offset":1867},{"name":"昭和","start":-1812153600000,"offset":1911},{"name":"大正","start":-1357603200000,"offset":1925},{"name":"明治","start":60022080000,"offset":1988}],
twoDigitYearMax: 99,
patterns: {
d: "gg y/M/d",
D: "gg y'年'M'月'd'日'",
t: "H:mm",
T: "H:mm:ss",
f: "gg y'年'M'月'd'日' H:mm",
F: "gg y'年'M'月'd'日' H:mm:ss",
M: "M'月'd'日'",
Y: "gg y'年'M'月'"
}
}
}
});
}( this ));

1573
external/globalize.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
(function($) {
var cultures = $.global.cultures,
en = cultures.en,
standard = en.calendars.standard,
culture = cultures["de-DE"] = $.extend(true, {}, en, {
name: "de-DE",
englishName: "German (Germany)",
nativeName: "Deutsch (Deutschland)",
language: "de",
numberFormat: {
',': ".",
'.': ",",
percent: {
pattern: ["-n%","n%"],
',': ".",
'.': ","
},
currency: {
pattern: ["-n $","n $"],
',': ".",
'.': ",",
symbol: "€"
}
},
calendars: {
standard: $.extend(true, {}, standard, {
'/': ".",
firstDay: 1,
days: {
names: ["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],
namesAbbr: ["So","Mo","Di","Mi","Do","Fr","Sa"],
namesShort: ["So","Mo","Di","Mi","Do","Fr","Sa"]
},
months: {
names: ["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],
namesAbbr: ["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""]
},
AM: null,
PM: null,
eras: [{"name":"n. Chr.","start":null,"offset":0}],
patterns: {
d: "dd.MM.yyyy",
D: "dddd, d. MMMM yyyy",
t: "HH:mm",
T: "HH:mm:ss",
f: "dddd, d. MMMM yyyy HH:mm",
F: "dddd, d. MMMM yyyy HH:mm:ss",
M: "dd MMMM",
Y: "MMMM yyyy"
}
})
}
}, cultures["de-DE"]);
culture.calendar = culture.calendars.standard;
})(jQuery);

View File

@ -1,74 +0,0 @@
(function($) {
var cultures = $.global.cultures,
en = cultures.en,
standard = en.calendars.standard,
culture = cultures["ja-JP"] = $.extend(true, {}, en, {
name: "ja-JP",
englishName: "Japanese (Japan)",
nativeName: "日本語 (日本)",
language: "ja",
numberFormat: {
percent: {
pattern: ["-n%","n%"]
},
currency: {
pattern: ["-$n","$n"],
decimals: 0,
symbol: "¥"
}
},
calendars: {
standard: $.extend(true, {}, standard, {
days: {
names: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],
namesAbbr: ["日","月","火","水","木","金","土"],
namesShort: ["日","月","火","水","木","金","土"]
},
months: {
names: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",""],
namesAbbr: ["1","2","3","4","5","6","7","8","9","10","11","12",""]
},
AM: ["午前","午前","午前"],
PM: ["午後","午後","午後"],
eras: [{"name":"西暦","start":null,"offset":0}],
patterns: {
d: "yyyy/MM/dd",
D: "yyyy'年'M'月'd'日'",
t: "H:mm",
T: "H:mm:ss",
f: "yyyy'年'M'月'd'日' H:mm",
F: "yyyy'年'M'月'd'日' H:mm:ss",
M: "M'月'd'日'",
Y: "yyyy'年'M'月'"
}
}),
Japanese: $.extend(true, {}, standard, {
name: "Japanese",
days: {
names: ["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],
namesAbbr: ["日","月","火","水","木","金","土"],
namesShort: ["日","月","火","水","木","金","土"]
},
months: {
names: ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月",""],
namesAbbr: ["1","2","3","4","5","6","7","8","9","10","11","12",""]
},
AM: ["午前","午前","午前"],
PM: ["午後","午後","午後"],
eras: [{"name":"平成","start":null,"offset":1867},{"name":"昭和","start":-1812153600000,"offset":1911},{"name":"大正","start":-1357603200000,"offset":1925},{"name":"明治","start":60022080000,"offset":1988}],
twoDigitYearMax: 99,
patterns: {
d: "gg y/M/d",
D: "gg y'年'M'月'd'日'",
t: "H:mm",
T: "H:mm:ss",
f: "gg y'年'M'月'd'日' H:mm",
F: "gg y'年'M'月'd'日' H:mm:ss",
M: "M'月'd'日'",
Y: "gg y'年'M'月'"
}
})
}
}, cultures["ja-JP"]);
culture.calendar = culture.calendars.standard;
})(jQuery);

File diff suppressed because it is too large Load Diff

View File

@ -240,7 +240,7 @@ $.widget( "ui.spinner", {
var newVal = this.value() + step * this._increment( this.counter );
// clamp the new value
// clamp the new value
newVal = this._trimValue( newVal );
if ( !this.spinning || this._trigger( "spin", event, { value: newVal } ) !== false) {
@ -308,14 +308,14 @@ $.widget( "ui.spinner", {
_parse: function( val ) {
if ( typeof val === "string" ) {
val = $.global && this.options.numberFormat ? $.global.parseFloat( val ) : +val;
val = window.Globalize && this.options.numberFormat ? Globalize.parseFloat( val ) : +val;
}
return isNaN( val ) ? null : val;
},
_format: function() {
var num = this.options.value;
return $.global && this.options.numberFormat ? $.global.format( num, this.options.numberFormat ) : num;
return window.Globalize && this.options.numberFormat ? Globalize.format( num, this.options.numberFormat ) : num;
},
_refresh: function() {