Skip to content

Commit 5b01602

Browse files
authored
Merge pull request #14 from thecodeorigin/dev/v1.1.1
feat: add code snippets
2 parents 86d6185 + fe0a5bd commit 5b01602

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

.vscode/i18n.code-snippets

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"i18n translate": {
3+
"scope": "vue-html",
4+
"prefix": ["t()", "$t()", "$i18n.$t()"],
5+
"body": ["$$t('${1}')"],
6+
"description": "Function of i18n to enable localization on a string"
7+
},
8+
"i18n translate full API": {
9+
"scope": "vue-html",
10+
"prefix": ["$i18n.$t()"],
11+
"body": ["$$t('${1}')"],
12+
"description": "Function of i18n to enable localization on a string"
13+
},
14+
"i18n translate composition": {
15+
"prefix": "i18n.t()",
16+
"body": ["i18n.t('${1}')"],
17+
"description": "Function of i18n to enable localization on a string in composition API"
18+
},
19+
"i18n template": {
20+
"scope": "vue",
21+
"prefix": "i18n template",
22+
"body": ["<i18n lang=\"yaml\">\r", "vi:\r", " ${1}\r", "</i18n>\r", ""],
23+
"description": "Template syntax for i18n in component"
24+
}
25+
}

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,26 @@ $ yarn generate
2222

2323
For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org).
2424

25-
## Special Directories
25+
## Snippets
26+
27+
Checkout .vscode for code snippets
28+
29+
The project is setup with some simple i18n snippets:
30+
31+
```javascript
32+
$t('');
33+
$i18n.$t('');
34+
i18n.t('');
35+
```
36+
37+
```yaml
38+
<i18n lang="yaml">
39+
fr:
40+
Your code: Votre code
41+
</i18n>
42+
```
43+
44+
## Directories
2645

2746
You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality.
2847

core/layouts/default.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</div>
1111
</template>
1212

13-
<script lang="ts">
13+
<script>
1414
import { defineComponent } from '@nuxtjs/composition-api';
1515
import MyNavbar from '@/components/layout/MyNavbar/MyNavbar.vue';
1616
import MySidebar from '@/components/layout/MySidebar/MySidebar.vue';

pages/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</div>
2929
</template>
3030

31-
<script lang="ts">
31+
<script>
3232
import { defineComponent } from '@nuxtjs/composition-api';
3333
3434
export default defineComponent({

0 commit comments

Comments
 (0)