Skip to content
This repository was archived by the owner on May 19, 2022. It is now read-only.

Commit d8f5fba

Browse files
authored
Merge pull request #32 from panter/features/component-plurals
Features/component plurals
2 parents bc0bdf1 + f2b5508 commit d8f5fba

File tree

5 files changed

+353
-510
lines changed

5 files changed

+353
-510
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,64 @@ Vue.component("app", {
158158
</i18next>
159159
</div>`
160160
});
161+
162+
Vue.component("app", {
163+
template: `
164+
<div>
165+
<i18next path="term" tag="label">
166+
<a href="#" target="_blank">{{ $t("tos") }}</a>
167+
<strong>{{ $t("promise") }}</strong>
168+
</i18next>
169+
</div>`
170+
});
171+
```
172+
173+
```javascript
174+
// i18next component support to specify the place
175+
176+
const locales = {
177+
en: {
178+
tos: "Term of Service",
179+
term: "I accept {{tos}}. {{promise}}.",
180+
promise: "I promise"
181+
}
182+
};
183+
184+
...
185+
186+
Vue.component("app", {
187+
template: `
188+
<div>
189+
<i18next path="term" tag="label">
190+
<a href="#" target="_blank" place="tos">{{ $t("tos") }}</a>
191+
<strong place="promise">{{ $t("promise") }}</strong>
192+
</i18next>
193+
</div>`
194+
});
161195
```
162196
197+
198+
```javascript
199+
// i18next component support the ($t)[https://www.i18next.com/overview/api#t] options param
200+
201+
const locales = {
202+
en: {
203+
counter: "{{0}} dude",
204+
counter_plural: "{{0}} dudes"
205+
}
206+
};
207+
208+
...
209+
210+
Vue.component("app", {
211+
template: `
212+
<div>
213+
<i18next path="term" tag="label" options="{ count: 2 }">
214+
<strong>Hello</strong>
215+
</i18next>
216+
</div>`
217+
});
218+
163219
### Directive
164220

165221
Full Featured properties:

0 commit comments

Comments
 (0)