Skip to content

Commit

Permalink
fix(index): Fix kazupon#193 ensure order of locales
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Mar 8, 2019
1 parent e84583c commit ce01c68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default class VueI18n {
get messages (): LocaleMessages { return looseClone(this._getMessages()) }
get dateTimeFormats (): DateTimeFormats { return looseClone(this._getDateTimeFormats()) }
get numberFormats (): NumberFormats { return looseClone(this._getNumberFormats()) }
get availableLocales (): Locale[] { return Object.keys(this.messages) }
get availableLocales (): Locale[] { return Object.keys(this.messages).sort() }

get locale (): Locale { return this._vm.locale }
set locale (locale: Locale): void {
Expand Down
6 changes: 2 additions & 4 deletions test/unit/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,10 +630,8 @@ describe('basic', () => {
})

describe('i18n#availableLocales', () => {
describe('en', () => {
it('should translate an english', () => {
assert.deepStrictEqual(i18n.availableLocales, ['ja', 'en'])
})
it('should return locales defined in messages in lexical order', () => {
assert.deepStrictEqual(i18n.availableLocales, ['en', 'ja'])
})
})

Expand Down
3 changes: 1 addition & 2 deletions vuepress/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,7 @@ The number formats of localization.

* **Examples:** `["en", "ja"]`

The list of available locales in `messages`.

The list of available locales in `messages` in lexical order.

#### formatter

Expand Down

0 comments on commit ce01c68

Please sign in to comment.