Skip to content
Browse files

default culture is named default

  • Loading branch information...
1 parent d074e1f commit 72df551fc5d148ba7f9d25dd6b307770480ee5af InfinitiesLoop committed
Showing with 15 additions and 14 deletions.
  1. +5 −5 README.md
  2. +10 −9 jquery.glob.js
View
10 README.md
@@ -52,7 +52,7 @@ A mapping of culture code to that culture. For example, jQuery.cultures.fr is an
<p>
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:
<pre>
-jQuery.culture = jQuery.cultures["FR-fr"];
+jQuery.culture = jQuery.cultures["fr-FR"];
</pre>
</p>
@@ -78,7 +78,7 @@ jQuery.preferCulture(["es-MX", "fr-FR"]);
alert(jQuery.culture.name) // 'fr'
</pre>
-In any case, if no match is found, the 'en' culture is selected.
+In any case, if no match is found, the 'default' culture is selected.
</p>
<a name="find"></a>
@@ -149,7 +149,7 @@ jQuery.localize("myplugin", "fr", {
var obj = jQuery.localize("myplugin", "fr");
alert(obj.foo); // "foo"
</pre>
-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.
+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.
<pre>
jQuery.localize("myplugin", "", {
foo: "foo (en)",
@@ -197,9 +197,9 @@ Using this mechanism, the 'fr' culture will be created if it does not exist. And
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.
</p>
<p>
-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:
+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:
<pre>
-jQuery.cultures.en = {
+jQuery.cultures['default'] = {
// A unique name for the culture in the form &lt;language code&gt;-&lt;country/region code&lt;
name: "English",
// the name of the culture in the english language
View
19 jquery.glob.js
@@ -5,12 +5,13 @@
(function($) {
var localized = { en: {} };
+localized["default"] = localized.en;
$.extend({
findClosestCulture: function(name) {
var match;
if ( !name ) {
- match = $.culture || $.cultures.en;
+ match = $.culture || $.cultures["default"];
}
else if ( $.isPlainObject( name ) ) {
match = name;
@@ -46,11 +47,11 @@ $.extend({
return match || null;
},
preferCulture: function(name) {
- $.culture = $.findClosestCulture( name ) || $.cultures.en;
+ $.culture = $.findClosestCulture( name ) || $.cultures["default"];
},
localize: function(key, culture, value) {
if (typeof culture === 'string') {
- culture = culture || "en";
+ culture = culture || "default";
culture = $.cultures[ culture ] || { name: culture };
}
var local = localized[ culture.name ];
@@ -70,7 +71,7 @@ $.extend({
value = language[ key ];
}
if ( typeof value === 'undefined' ) {
- value = localized.en[ key ];
+ value = localized["default"][ key ];
}
}
}
@@ -193,8 +194,8 @@ $.extend({
// 1. When defining a culture, all fields are required except the ones stated as optional.
// 2. You can use $.extend to copy an existing culture and provide only the differing values,
-// a good practice since most cultures do not differ too much from the 'en' culture.
-// DO use the 'en' culture if you do this, as it is the only one that definitely
+// a good practice since most cultures do not differ too much from the 'default' culture.
+// DO use the 'default' culture if you do this, as it is the only one that definitely
// exists.
// 3. Other plugins may add to the culture information provided by extending it. However,
// that plugin may extend it prior to the culture being defined, or after. Therefore,
@@ -206,12 +207,12 @@ $.extend({
// it may be dynamically changed at any time to one of the calendars in ".calendars".
// To define a culture, use the following pattern, which handles defining the culture based
-// on the 'en culture, extending it with the existing culture if it exists, and defining
+// on the 'default culture, extending it with the existing culture if it exists, and defining
// it if it does not exist.
-// $.cultures.foo = $.extend(true, $.extend(true, {}, $.cultures.en, fooCulture), $.cultures.foo)
+// $.cultures.foo = $.extend(true, $.extend(true, {}, $.cultures['default'], fooCulture), $.cultures.foo)
var cultures = $.cultures = $.cultures || {};
-var en = cultures.en = $.extend(true, {
+var en = cultures["default"] = cultures.en = $.extend(true, {
// A unique name for the culture in the form <language code>-<country/region code>
name: "en",
// the name of the culture in the english language

0 comments on commit 72df551

Please sign in to comment.
Something went wrong with that request. Please try again.