Skip to content
This repository was archived by the owner on Dec 12, 2020. It is now read-only.

Commit 35a6a36

Browse files
committed
Merge remote-tracking branch 'origin' into jess/i18n-external-file
2 parents 035becb + abb95e0 commit 35a6a36

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!-- uses special loader to load i18n blocks -->
2+
<!-- see https://github.com/intlify/vue-i18n-loader -->
3+
<i18n>
4+
{
5+
"en": {
6+
"hello": "hello world!"
7+
},
8+
"fa": {
9+
"hello": "سلام دنیا"
10+
},
11+
"ja": {
12+
"hello": "こんにちは、世界"
13+
},
14+
"ru": {
15+
"hello": "Привет мир"
16+
}
17+
}
18+
</i18n>
19+
20+
<template>
21+
<div id="app">
22+
<label for="locale">locale</label>
23+
<select v-model="locale" id="locale">
24+
<option>en</option>
25+
<option>fa</option>
26+
<option>ja</option>
27+
<option>ru</option>
28+
</select>
29+
<p>message: {{ $t('hello') }}</p>
30+
</div>
31+
</template>
32+
33+
<script>
34+
export default {
35+
name: 'TranslatedMessage',
36+
data () {
37+
return { locale: 'en' }
38+
},
39+
watch: {
40+
locale (val) {
41+
this.$i18n.locale = val
42+
}
43+
}
44+
}
45+
</script>

0 commit comments

Comments
 (0)