Skip to content

Commit 545ccb7

Browse files
committed
Add docs
1 parent d435e6b commit 545ccb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+13332
-9370
lines changed

.DS_Store

6 KB
Binary file not shown.

.eslintrc.json

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
{
2-
"env": {
3-
"browser": true,
4-
"es2021": true
5-
},
6-
"extends": [
7-
"standard"
8-
],
9-
"parser": "@typescript-eslint/parser",
10-
"parserOptions": {
11-
"ecmaVersion": 12,
12-
"sourceType": "module"
13-
},
14-
"plugins": [
15-
"@typescript-eslint"
16-
],
17-
"rules": {
18-
}
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": ["standard"],
7+
"parser": "@typescript-eslint/parser",
8+
"parserOptions": {
9+
"ecmaVersion": 12,
10+
"sourceType": "module"
11+
},
12+
"plugins": ["@typescript-eslint"],
13+
"rules": {}
1914
}

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
examples/*
2+
packages/*

CHANGELOG.md

Whitespace-only changes.

README.md

Lines changed: 10 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,19 @@
1-
# vue3-i18n
1+
<h1 align="center">Vue3-i18n</h1>
22

3-
![Vue 3.x](https://img.shields.io/badge/vue-3.x-green.svg "Vue 3 Compatible")
3+
<p align="center">Internationalization plugin for Vue.js 3.0</p>
44

5-
I18n for vue3.
5+
## :warning: NOTICE
66

7-
**Note:**
7+
This repository is for Vue3-i18n.
88

9-
Issue/PR is welcomed, I'll response as soon as possible.
9+
## :book: Documentation
1010

11-
If you like this pack, can give a star.
11+
About Vue3 I18n, See [here](https://vue3-i18n.webkong.cn)
1212

13-
## install
13+
## :scroll: Changelog
1414

15-
`npm install vue3-i18n --save`
15+
Detailed changes for each release are documented in the [CHANGELOG.md](https://github.com/webkong/vue3-i18n/blob/master/CHANGELOG.md).
1616

17-
## Quickstart
17+
## :copyright: License
1818

19-
```javascript
20-
// i18n.js
21-
import { createI18n } from "vue3-i18n";
22-
23-
const messages = {
24-
en: {
25-
menu: ["Home"],
26-
test: "test",
27-
object: {
28-
a: "1233",
29-
},
30-
parse: "welcome to {name}",
31-
parses: {
32-
a: "welcome to {name}",
33-
},
34-
},
35-
zh: {
36-
menu: ["首页"],
37-
test: "测试",
38-
object: {
39-
a: "1233",
40-
},
41-
parse: "welcome to {name}",
42-
parses: {
43-
a: "welcome to {name}",
44-
},
45-
},
46-
};
47-
48-
const i18n = createI18n({
49-
locale: "en",
50-
messages: messages,
51-
});
52-
53-
export default i18n;
54-
```
55-
56-
```javascript
57-
// main.js
58-
import { createApp } from "vue";
59-
import i18n from "./i18n";
60-
61-
const app = createApp(App);
62-
63-
app.use(i18n).mount("#app");
64-
```
65-
66-
## Usage
67-
68-
```html
69-
<p>{{ $t("test") }}</p>
70-
<!-- array -->
71-
<p>{{ $t("menu[0]") }}</p>
72-
<!-- object -->
73-
<p>{{ $t("object.a") }}</p>
74-
<!-- parse -->
75-
<p>{{ $t("parse", { name: "wangsw" }) }}</p>
76-
<p>{{ $t("parses.a", { name: "wangsw" }) }}</p>
77-
```
78-
79-
```javascript
80-
<script>
81-
import { useI18n } from "vue3-i18n";
82-
export default {
83-
setup() {
84-
const i18n = useI18n();
85-
const setLocale = (lang) => {
86-
i18n.setLocale(lang);
87-
};
88-
89-
return {
90-
setLocale,
91-
};
92-
},
93-
};
94-
</script>
95-
```
96-
97-
### API
98-
99-
### i18n.t(key,parmas)
100-
101-
| t() | Type | Description |
102-
| ------ | -------- | --------------- |
103-
| key | `string` | translate text |
104-
| params | `object` | format params |
105-
| return | `string` | translated text |
106-
107-
### i18n.setLocale()
108-
109-
| setLocale() | Type | Description |
110-
| ----------- | -------- | ----------- |
111-
| params | `string` | set locale |
112-
| return | `void` | |
113-
114-
### i18n.getLocale()
115-
116-
| getLocale() | Type | Description |
117-
| ----------- | -------- | -------------- |
118-
| params | `void` | |
119-
| return | `string` | current locale |
120-
121-
## TODO
122-
123-
- [ ] directive
124-
- [x] Named formatting
125-
126-
## License
127-
128-
MIT
19+
[MIT](http://opensource.org/licenses/MIT)

dist/index.esm.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/index.umd.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/types.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ export interface I18nConfig {
66
locale?: string;
77
messages: Messages;
88
}
9-
export interface Params extends Object {
10-
}
119
export interface I18nInstance {
1210
messages: Messages;
1311
t: (key: string) => string;

dist/vue3-i18n.common.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue3-i18n.esm.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)