'Vue class equivalent for setup(){const { t } = useI18n({ inheritLocale: true, useScope: 'local' })}
I want to implement i18n for translating purposes and I know how to do it in Vue 3 like :
const { t } = useI18n({
inheritLocale: true,
useScope: 'local'
})
and then something like :
{{ t('p1') }}
having locales configured beforehand. Now I've tried this working with classes :
export default class App extends Vue {
i18n = new useI18n({});
}
and after that something like this in the html :
{{ i18n.t("p1") }}
and nothing happened. Can someone help me on this ?
Solution 1:[1]
It seems the solution was closer than I thought
just to add $ like this:
{{ $i18n.t("p1") }}
and it works, have not to add the aforementioned values...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Maykel Contreras Camacho |
