-
-
Notifications
You must be signed in to change notification settings - Fork 861
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add failing test case * Fix typings for component options
- Loading branch information
Showing
2 changed files
with
48 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Vue, { ComponentOptions } from 'vue'; | ||
import VueI18n from "../index"; | ||
|
||
// setup locale info for root Vue instance | ||
const i18n = new VueI18n({ | ||
locale: 'ja', | ||
messages: { | ||
en: { | ||
message: { | ||
hello: 'hello world', | ||
greeting: 'good morning' | ||
} | ||
}, | ||
ja: { | ||
message: { | ||
hello: 'こんにちは、世界', | ||
greeting: 'おはようございます' | ||
} | ||
} | ||
} | ||
}) | ||
|
||
// Define component | ||
const Component1 = { | ||
template: ` | ||
<div class="container"> | ||
<p>Component1 locale messages: {{ $t("message.hello") }}</p> | ||
<p>Fallback global locale messages: {{ $t("message.greeting") }}</p> | ||
</div>`, | ||
i18n: { // `i18n` option | ||
messages: { | ||
en: { message: { hello: 'hello component1' } }, | ||
ja: { message: { hello: 'こんにちは、component1' } } | ||
} | ||
} | ||
} | ||
|
||
new Vue({ | ||
i18n, | ||
components: { | ||
Component1 | ||
} | ||
}).$mount('#app') |