Hi, first at all, this is a great & simpler package, it's very useful.
I'm thinking about the use of second/plural argument in __n function. Making some checks and viewing your tests and implementation, the second argument seems to be meaningless except for keeping it in a file if it doesn't exist. For example:
it('allows an alternative locale to be set', function () {
var __n = y18n({
locale: 'pirate',
directory: path.join(__dirname, 'locales')
}).__n
__n('%d cat', '%d cats', 1).should.equal('1 land catfish')
__n('%d cat', '%d cats', 3).should.equal('3 land catfishes')
})
Here I can write __n('%d cat', 'foo bar', 3) and still get 3 land catfishes.
unknown
Perhaps it might be more useful (sometimes at least) to have another method y18n.__p(key, number, ...args) to use without worrying about updateFiles feature or maybe with a default "unknown" value.
I don't know... It's just a practical suggestion.
Hi, first at all, this is a great & simpler package, it's very useful.
I'm thinking about the use of second/plural argument in
__nfunction. Making some checks and viewing your tests and implementation, the second argument seems to be meaningless except for keeping it in a file if it doesn't exist. For example:Here I can write
__n('%d cat', 'foo bar', 3)and still get3 land catfishes.unknown
Perhaps it might be more useful (sometimes at least) to have another method
y18n.__p(key, number, ...args)to use without worrying about updateFiles feature or maybe with a default "unknown" value.I don't know... It's just a practical suggestion.