Permalink
Browse files

Mapping languages to lingo[code] instead of lingo.Language[code]

  • Loading branch information...
1 parent dc94d41 commit fba8cb5d8725c2f5038f60b7a00d52e22a62fbeb @tj committed Sep 27, 2010
Showing with 11 additions and 5 deletions.
  1. +1 −1 Readme.md
  2. +7 −1 lib/language.js
  3. +1 −1 test/inflection.en.test.js
  4. +1 −1 test/lingo.test.js
  5. +1 −1 test/translation.test.js
View
2 Readme.md
@@ -100,7 +100,7 @@ New languages can be defined as shown below:
The language code passed to `Language()` self-registers itself, so you could grab the implementation via:
- var fr = require('lingo').Language.fr;
+ var fr = require('lingo').fr;
## License
View
8 lib/language.js
@@ -6,6 +6,12 @@
*/
/**
+ * Module dependencies.
+ */
+
+var lingo = require('./lingo');
+
+/**
* Initialize a new `Language` with the given `code`.
*
* @param {String} code
@@ -21,7 +27,7 @@ var Language = module.exports = function Language(code) {
, uncountable: {}
, irregular: { plural: {}, singular: {}}
};
- Language[code] = this;
+ lingo[code] = this;
};
/**
View
2 test/inflection.en.test.js
@@ -4,7 +4,7 @@
*/
var lingo = require('lingo')
- , en = lingo.Language.en;
+ , en = lingo.en;
module.exports = {
'test .isUncountable()': function(assert){
View
2 test/lingo.test.js
@@ -31,6 +31,6 @@ module.exports = {
},
'test Language mapping': function(assert){
- assert.equal('en', lingo.Language.en.code);
+ assert.equal('en', lingo.en.code);
}
}
View
2 test/translation.test.js
@@ -4,7 +4,7 @@
*/
var lingo = require('lingo')
- , en = lingo.Language.en;
+ , en = lingo.en;
var fr = new lingo.Language('fr');

0 comments on commit fba8cb5

Please sign in to comment.