-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple locale directories (#114)
* WIP: Add support for multiple locale directories * Add testcases
- Loading branch information
Showing
31 changed files
with
785 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
tests/fixtures/no-duplicate-keys-in-locale/invalid/multiple-locales/locales1/en.1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"hello": "hello", | ||
"messages": { | ||
"foo": "foo", | ||
"bar": "bar", | ||
"baz": "baz", | ||
"dupe": "dupe" | ||
}, | ||
"dupe": "dupe" | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/fixtures/no-duplicate-keys-in-locale/invalid/multiple-locales/locales2/en.2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"good-bye": "good bye", | ||
"messages": { | ||
"qux": "qux", | ||
"quux": "quux", | ||
"corge": "corge", | ||
"dupe": "dupe" | ||
}, | ||
"dupe": "dupe" | ||
} |
11 changes: 11 additions & 0 deletions
11
tests/fixtures/no-duplicate-keys-in-locale/invalid/multiple-locales/locales3/index.1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"ja": { | ||
"hello": "こんにちは", | ||
"messages": { | ||
"foo": "foo", | ||
"bar": "bar", | ||
"baz": "baz" | ||
}, | ||
"dupe": "dupe" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/fixtures/no-duplicate-keys-in-locale/invalid/multiple-locales/locales3/index.2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'ja': | ||
'good-bye': 'さようなら' | ||
'messages': | ||
'qux': 'qux' | ||
'quux': 'quux' | ||
'corge': 'corge' | ||
'dupe': 'dupe' | ||
'dupe': 'dupe' |
33 changes: 33 additions & 0 deletions
33
tests/fixtures/no-duplicate-keys-in-locale/invalid/multiple-locales/src/App.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<i18n lang="yaml"> | ||
en: | ||
block: block | ||
nest: | ||
foo | ||
ja: | ||
block: block | ||
nest: | ||
foo: bar | ||
</i18n> | ||
<i18n lang="yaml"> | ||
en: | ||
nest: | ||
foo: bar | ||
ja: | ||
dupe: dupe | ||
</i18n> | ||
<i18n lang="json"> | ||
{ | ||
"en": { | ||
"json-dupe": "dupe", | ||
"nest": { | ||
"json-dupe": "dupe" | ||
}, | ||
"nest": { | ||
"json-dupe": "dupe" | ||
}, | ||
"json-dupe": "dupe" | ||
} | ||
} | ||
</i18n> | ||
<template></template> | ||
<script></script> |
8 changes: 8 additions & 0 deletions
8
tests/fixtures/no-duplicate-keys-in-locale/valid/multiple-locales/locales1/en.1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"hello": "hello", | ||
"messages": { | ||
"foo": "foo", | ||
"bar": "bar", | ||
"baz": "baz" | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/fixtures/no-duplicate-keys-in-locale/valid/multiple-locales/locales2/en.2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"good-bye": "good bye", | ||
"messages": { | ||
"qux": "qux", | ||
"quux": "quux", | ||
"corge": "corge" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/fixtures/no-duplicate-keys-in-locale/valid/multiple-locales/locales3/index.1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"ja": { | ||
"hello": "こんにちは", | ||
"messages": { | ||
"foo": "foo", | ||
"bar": "bar", | ||
"baz": "baz" | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
tests/fixtures/no-duplicate-keys-in-locale/valid/multiple-locales/locales3/index.2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"ja": { | ||
"good-bye": "さようなら", | ||
"messages": { | ||
"qux": "qux", | ||
"quux": "quux", | ||
"corge": "corge" | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/fixtures/no-duplicate-keys-in-locale/valid/multiple-locales/src/App.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<i18n locale="en" lang="yaml"> | ||
block: block | ||
</i18n> | ||
<i18n locale="ja" lang="yaml"> | ||
block: block | ||
</i18n> | ||
<template></template> | ||
<script></script> |
11 changes: 11 additions & 0 deletions
11
tests/fixtures/no-missing-keys/multiple-locales/locales1/en.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"hello": "hello world", | ||
"messages": { | ||
"hello": "hi DIO!", | ||
"link": "@:message.hello", | ||
"nested": { | ||
"hello": "hi jojo!" | ||
}, | ||
"en-only": "en-only" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/fixtures/no-missing-keys/multiple-locales/locales2/index.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"ja": { | ||
"hello": "ハローワールド", | ||
"messages": { | ||
"hello": "こんにちは、DIO!", | ||
"link": "@:message.hello", | ||
"nested": { | ||
"hello": "こんにちは、ジョジョ!" | ||
} | ||
}, | ||
"hello_dio": "こんにちは、アンダースコア DIO!", | ||
"hello {name}": "こんにちは、{name}!", | ||
"hello-dio": "こんにちは、ハイフン DIO!" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/no-missing-keys/multiple-locales/locales3/en.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"hello_dio": "hello underscore DIO!", | ||
"hello {name}": "hello {name}!", | ||
"hello-dio": "hello hyphen DIO!" | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/fixtures/no-missing-keys/multiple-locales/src/App.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<template> | ||
<div id="app"> | ||
<p v-t="'hello_dio'">{{ $t('messages.hello') }}</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'App', | ||
created() { | ||
this.$i18n.t('hello {name}', { name: 'DIO' }) | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const $t = () => {} | ||
$t('hello') |
10 changes: 10 additions & 0 deletions
10
tests/fixtures/no-unused-keys/invalid/multiple-locales/locales1/en.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"hello": "hello world", | ||
"messages": { | ||
"hello": "hi DIO!", | ||
"link": "@:message.hello", | ||
"nested": { | ||
"hello": "hi jojo!" | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/no-unused-keys/invalid/multiple-locales/locales2/en.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"hello_dio": "hello underscore DIO!", | ||
"hello {name}": "hello {name}!", | ||
"hello-dio": "hello hyphen DIO!" | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/fixtures/no-unused-keys/invalid/multiple-locales/locales3/index.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"ja": { | ||
"hello": "ハローワールド", | ||
"messages": { | ||
"hello": "こんにちは、DIO!", | ||
"link": "@:message.hello", | ||
"nested": { | ||
"hello": "こんにちは、ジョジョ!" | ||
} | ||
}, | ||
"hello_dio": "こんにちは、アンダースコア DIO!", | ||
"hello {name}": "こんにちは、{name}!", | ||
"hello-dio": "こんにちは、ハイフン DIO!" | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/fixtures/no-unused-keys/invalid/multiple-locales/src/App.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<template> | ||
<div id="app"> | ||
<p v-t="'hello_dio'">{{ $t('messages.hello') }}</p> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'App', | ||
created() { | ||
this.$i18n.t('hello {name}', { name: 'DIO' }) | ||
} | ||
} | ||
</script> |
2 changes: 2 additions & 0 deletions
2
tests/fixtures/no-unused-keys/invalid/multiple-locales/src/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
const $t = () => {} | ||
$t('hello') |
7 changes: 7 additions & 0 deletions
7
tests/fixtures/no-unused-keys/valid/multiple-locales/locales1/en.1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"hello": "hello world", | ||
"messages": { | ||
"hello": "hi DIO!", | ||
"link": "@:messages.hello" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
tests/fixtures/no-unused-keys/valid/multiple-locales/locales2/en.2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"hello_dio": "hello underscore DIO!", | ||
"hello {name}": "hello {name}!", | ||
"term": "I accept xxx {0}." | ||
} |
Oops, something went wrong.