Skip to content

Commit

Permalink
Mapping languages to lingo[code] instead of lingo.Language[code]
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 27, 2010
1 parent dc94d41 commit fba8cb5
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion lib/language.js
Expand Up @@ -5,6 +5,12 @@
* MIT Licensed
*/

/**
* Module dependencies.
*/

var lingo = require('./lingo');

/**
* Initialize a new `Language` with the given `code`.
*
Expand All @@ -21,7 +27,7 @@ var Language = module.exports = function Language(code) {
, uncountable: {}
, irregular: { plural: {}, singular: {}}
};
Language[code] = this;
lingo[code] = this;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion test/inflection.en.test.js
Expand Up @@ -4,7 +4,7 @@
*/

var lingo = require('lingo')
, en = lingo.Language.en;
, en = lingo.en;

module.exports = {
'test .isUncountable()': function(assert){
Expand Down
2 changes: 1 addition & 1 deletion test/lingo.test.js
Expand Up @@ -31,6 +31,6 @@ module.exports = {
},

'test Language mapping': function(assert){
assert.equal('en', lingo.Language.en.code);
assert.equal('en', lingo.en.code);
}
}
2 changes: 1 addition & 1 deletion test/translation.test.js
Expand Up @@ -4,7 +4,7 @@
*/

var lingo = require('lingo')
, en = lingo.Language.en;
, en = lingo.en;

var fr = new lingo.Language('fr');

Expand Down

0 comments on commit fba8cb5

Please sign in to comment.