Skip to content

Commit

Permalink
🐛 bug(path): fix nested key translation
Browse files Browse the repository at this point in the history
Closes #97
  • Loading branch information
kazupon committed Dec 17, 2016
1 parent 4cac8b9 commit e15ead4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ pathStateMachine[IN_PATH] = {

pathStateMachine[BEFORE_IDENT] = {
'ws': [BEFORE_IDENT],
'ident': [IN_IDENT, APPEND]
'ident': [IN_IDENT, APPEND],
'0': [IN_IDENT, APPEND],
'number': [IN_IDENT, APPEND]
}

pathStateMachine[IN_IDENT] = {
Expand Down
8 changes: 6 additions & 2 deletions test/specs/fixture/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default {
link_end: 'This is a linked translation to @:message.hello',
link_within: 'Isn\'t @:message.hello we live in great?',
link_multiple: 'Hello @:message.hoge!, isn\'t @:message.hello great?',
'hyphen-locale': 'hello hyphen'
'hyphen-locale': 'hello hyphen',
'1234': 'Number-based keys are found',
'1mixedKey': 'Mixed keys are not found.'
},
'hello world': 'Hello World',
'Hello {0}': 'Hello {0}',
Expand Down Expand Up @@ -51,7 +53,9 @@ export default {
list: 'こんにちは {0}, ごきげんいかが?'
},
fallback1: 'これはフォールバック',
'hyphen-locale': 'こんにちは、ハイフン'
'hyphen-locale': 'こんにちは、ハイフン',
'1234': '数字ベースのキーは見つかりませんでした。',
'1mixedKey': 'ミックスされたキーは見つかりませんでした。'
},
plurals: {
car: 'ザ・ワールド | これはフォールバック',
Expand Down
13 changes: 13 additions & 0 deletions test/specs/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,17 @@ describe('issues', () => {
}
})
})

describe('#97', () => {
it('should be translated', () => {
assert.equal(
vm.$t('message.1234'),
locales[Vue.config.lang]['message']['1234']
)
assert.equal(
vm.$t('message.1mixedKey'),
locales[Vue.config.lang]['message']['1mixedKey']
)
})
})
})

0 comments on commit e15ead4

Please sign in to comment.