Skip to content

Commit 72df551

Browse files
author
InfinitiesLoop
committed
default culture is named default
1 parent d074e1f commit 72df551

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ A mapping of culture code to that culture. For example, jQuery.cultures.fr is an
5252
<p>
5353
This is set to the culture currently being used. This serves as the default culture if no culture is specified on the various parsing and formatting functions. For example, to change the current culture, set it to one of the available cultures:
5454
<pre>
55-
jQuery.culture = jQuery.cultures["FR-fr"];
55+
jQuery.culture = jQuery.cultures["fr-FR"];
5656
</pre>
5757
</p>
5858

@@ -78,7 +78,7 @@ jQuery.preferCulture(["es-MX", "fr-FR"]);
7878
alert(jQuery.culture.name) // 'fr'
7979
</pre>
8080

81-
In any case, if no match is found, the 'en' culture is selected.
81+
In any case, if no match is found, the 'default' culture is selected.
8282
</p>
8383

8484
<a name="find"></a>
@@ -149,7 +149,7 @@ jQuery.localize("myplugin", "fr", {
149149
var obj = jQuery.localize("myplugin", "fr");
150150
alert(obj.foo); // "foo"
151151
</pre>
152-
Note that localize() will find the closest match available per the same semantics as the jQuery.findClosestCulture function. If there is no match, the translation given is for the 'en' culture, if one was specified.
152+
Note that localize() will find the closest match available per the same semantics as the jQuery.findClosestCulture function. If there is no match, the translation given is for the 'default' culture, if one was specified.
153153
<pre>
154154
jQuery.localize("myplugin", "", {
155155
foo: "foo (en)",
@@ -197,9 +197,9 @@ Using this mechanism, the 'fr' culture will be created if it does not exist. And
197197
Each culture is defined in its own script with the naming scheme jQuery.glob.&lt;code&gt;.js (along with its minified version, jQuery.glob.&lt;code&gt;.min.js). You may include any number of these scripts, making them available in the jQuery.cultures mapping. Including one of these scripts does NOT automatically make it the default culture selected with jQuery.culture.
198198
</p>
199199
<p>
200-
The default culture that comes with jQuery.glob.js is 'en', and heavily commented, describing the purpose of each of the fields defined by a culture. Note that every culture includes all of these fields, even if they are the same as this culture. However, the script uses jQuery's $.extend to copy from this culture, so looking at the raw scripts will only show you what is different in that culture from 'en'. The 'en' culture is listed here along with the comments:
200+
The default culture that comes with jQuery.glob.js is 'default', and heavily commented, describing the purpose of each of the fields defined by a culture. Note that every culture includes all of these fields, even if they are the same as this culture. However, the script uses jQuery's $.extend to copy from this culture, so looking at the raw scripts will only show you what is different in that culture from 'default'. The 'default' culture is listed here along with the comments:
201201
<pre>
202-
jQuery.cultures.en = {
202+
jQuery.cultures['default'] = {
203203
// A unique name for the culture in the form &lt;language code&gt;-&lt;country/region code&lt;
204204
name: "English",
205205
// the name of the culture in the english language

jquery.glob.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
(function($) {
66

77
var localized = { en: {} };
8+
localized["default"] = localized.en;
89

910
$.extend({
1011
findClosestCulture: function(name) {
1112
var match;
1213
if ( !name ) {
13-
match = $.culture || $.cultures.en;
14+
match = $.culture || $.cultures["default"];
1415
}
1516
else if ( $.isPlainObject( name ) ) {
1617
match = name;
@@ -46,11 +47,11 @@ $.extend({
4647
return match || null;
4748
},
4849
preferCulture: function(name) {
49-
$.culture = $.findClosestCulture( name ) || $.cultures.en;
50+
$.culture = $.findClosestCulture( name ) || $.cultures["default"];
5051
},
5152
localize: function(key, culture, value) {
5253
if (typeof culture === 'string') {
53-
culture = culture || "en";
54+
culture = culture || "default";
5455
culture = $.cultures[ culture ] || { name: culture };
5556
}
5657
var local = localized[ culture.name ];
@@ -70,7 +71,7 @@ $.extend({
7071
value = language[ key ];
7172
}
7273
if ( typeof value === 'undefined' ) {
73-
value = localized.en[ key ];
74+
value = localized["default"][ key ];
7475
}
7576
}
7677
}
@@ -193,8 +194,8 @@ $.extend({
193194

194195
// 1. When defining a culture, all fields are required except the ones stated as optional.
195196
// 2. You can use $.extend to copy an existing culture and provide only the differing values,
196-
// a good practice since most cultures do not differ too much from the 'en' culture.
197-
// DO use the 'en' culture if you do this, as it is the only one that definitely
197+
// a good practice since most cultures do not differ too much from the 'default' culture.
198+
// DO use the 'default' culture if you do this, as it is the only one that definitely
198199
// exists.
199200
// 3. Other plugins may add to the culture information provided by extending it. However,
200201
// that plugin may extend it prior to the culture being defined, or after. Therefore,
@@ -206,12 +207,12 @@ $.extend({
206207
// it may be dynamically changed at any time to one of the calendars in ".calendars".
207208

208209
// To define a culture, use the following pattern, which handles defining the culture based
209-
// on the 'en culture, extending it with the existing culture if it exists, and defining
210+
// on the 'default culture, extending it with the existing culture if it exists, and defining
210211
// it if it does not exist.
211-
// $.cultures.foo = $.extend(true, $.extend(true, {}, $.cultures.en, fooCulture), $.cultures.foo)
212+
// $.cultures.foo = $.extend(true, $.extend(true, {}, $.cultures['default'], fooCulture), $.cultures.foo)
212213

213214
var cultures = $.cultures = $.cultures || {};
214-
var en = cultures.en = $.extend(true, {
215+
var en = cultures["default"] = cultures.en = $.extend(true, {
215216
// A unique name for the culture in the form <language code>-<country/region code>
216217
name: "en",
217218
// the name of the culture in the english language

0 commit comments

Comments
 (0)