Skip to content

Commit

Permalink
upgrade y18n to 3.1.0 so splicing lang from locale is unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
nexdrew committed Aug 19, 2015
1 parent db5af49 commit b43406c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ function Argv (processArgs, cwd) {
}

function guessLocale () {
return osLocale.sync().split('_')[0]
return osLocale.sync()
}

sigletonify(self)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"decamelize": "^1.0.0",
"os-locale": "^1.2.0",
"window-size": "^0.1.1",
"y18n": "^3.0.0"
"y18n": "^3.1.0"
},
"devDependencies": {
"chai": "^3.0.0",
Expand Down
14 changes: 5 additions & 9 deletions test/yargs.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,21 +311,17 @@ describe('yargs dsl tests', function () {
})

describe('locale', function () {
it('returns locale if locale is called with no arguments', function () {
yargs.locale().should.equal('en')
})

it("detects the operating system's locale", function () {
loadLocale('es_ES.UTF-8')
yargs.locale().should.equal('es')
loadLocale('en_EN.UTF-8')
yargs.locale().should.equal('es_ES')
loadLocale('en_US.UTF-8')
})

it("it allows the operating system's locale to be overridden", function () {
loadLocale('es_ES.UTF-8')
yargs.locale('en')
yargs.locale().should.equal('en')
loadLocale('en_EN.UTF-8')
loadLocale('en_US.UTF-8')
})

function loadLocale (locale) {
Expand Down Expand Up @@ -359,8 +355,8 @@ describe('yargs dsl tests', function () {
.argv
})

yargs.locale().should.equal('zz')
loadLocale('en_EN.UTF-8')
yargs.locale().should.equal('zz_ZZ')
loadLocale('en_US.UTF-8')
r.logs.join(' ').should.match(/Commands:/)
})

Expand Down

0 comments on commit b43406c

Please sign in to comment.