Skip to content

Commit 0ec6372

Browse files
committed
🍭 examples: add demo project
1 parent 89e61b1 commit 0ec6372

File tree

16 files changed

+298
-0
lines changed

16 files changed

+298
-0
lines changed

demo/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VUE_APP_I18N_LOCALE=ja
2+
VUE_APP_I18N_FALLBACK_LOCALE=ja

demo/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw?

demo/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# vue-i18n-demo1
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn run build
16+
```
17+
18+
### Run your tests
19+
```
20+
yarn run test
21+
```
22+
23+
### Lints and fixes files
24+
```
25+
yarn run lint
26+
```
27+
28+
### Customize configuration
29+
See [Configuration Reference](https://cli.vuejs.org/config/).

demo/babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/app'
4+
]
5+
}

demo/package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "vue-i18n-locale-message-demo",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint",
9+
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
10+
},
11+
"dependencies": {
12+
"core-js": "^2.6.5",
13+
"vue": "^2.6.10",
14+
"vue-i18n": "^8.14.0"
15+
},
16+
"devDependencies": {
17+
"@kazupon/vue-i18n-loader": "^0.4.1",
18+
"@vue/cli-plugin-babel": "^3.11.0",
19+
"@vue/cli-plugin-eslint": "^3.11.0",
20+
"@vue/cli-service": "^3.11.0",
21+
"babel-eslint": "^10.0.1",
22+
"eslint": "^5.16.0",
23+
"eslint-plugin-vue": "^5.0.0",
24+
"vue-cli-plugin-i18n": "^0.6.0",
25+
"vue-template-compiler": "^2.6.10"
26+
},
27+
"eslintConfig": {
28+
"root": true,
29+
"env": {
30+
"node": true
31+
},
32+
"extends": [
33+
"plugin:vue/essential",
34+
"eslint:recommended"
35+
],
36+
"rules": {},
37+
"parserOptions": {
38+
"parser": "babel-eslint"
39+
}
40+
},
41+
"postcss": {
42+
"plugins": {
43+
"autoprefixer": {}
44+
}
45+
},
46+
"browserslist": [
47+
"> 1%",
48+
"last 2 versions"
49+
]
50+
}

demo/public/favicon.ico

4.19 KB
Binary file not shown.

demo/public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title>vue-i18n-demo1</title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but vue-i18n-demo1 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

demo/src/App.vue

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<template>
2+
<div id="app">
3+
<h1>{{ $t("title") }}</h1>
4+
<form>
5+
<label for="locale">{{ $t('lang') }}:</label>
6+
<select v-model="$parent.$i18n.locale">
7+
<option value="en">en</option>
8+
<option value="ja">ja</option>
9+
</select>
10+
</form>
11+
<Login />
12+
</div>
13+
</template>
14+
15+
<script>
16+
import Login from './pages/Login.vue'
17+
18+
export default {
19+
name: "app",
20+
components: {
21+
Login
22+
}
23+
}
24+
</script>
25+
26+
<style>
27+
#app {
28+
font-family: "Avenir", Helvetica, Arial, sans-serif;
29+
-webkit-font-smoothing: antialiased;
30+
-moz-osx-font-smoothing: grayscale;
31+
text-align: center;
32+
color: #2c3e50;
33+
margin-top: 60px;
34+
}
35+
</style>
36+
37+
<i18n>
38+
{
39+
"ja": {
40+
"title": "アプリケーション",
41+
"lang": "言語切り替え"
42+
},
43+
"en": {
44+
"title": "Application",
45+
"lang": "Change languages"
46+
}
47+
}
48+
</i18n>

demo/src/components/Modal.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<p>modal template</p>
3+
</template>
4+
5+
<script>
6+
export default {
7+
name: "Modal"
8+
}
9+
</script>
10+
11+
<i18n locale="en">
12+
{
13+
"ok": "OK",
14+
"cancel": "Cancel"
15+
}
16+
</i18n>
17+
18+
<i18n locale="ja">
19+
{
20+
"ok": "OK",
21+
"cancel": "キャンセル"
22+
}
23+
</i18n>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<p>ranking table template</p>
3+
</template>
4+
5+
<script>
6+
export default {
7+
name: "RankingTable"
8+
}
9+
</script>
10+
11+
<i18n locale="en">
12+
{
13+
"headers": {
14+
"rank": "Rank",
15+
"name": "Name",
16+
"score": "Score"
17+
}
18+
}
19+
</i18n>

0 commit comments

Comments
 (0)