Missing documentation for `rt` in i18n
In the i18n vue docs https://vue-i18n.intlify.dev/api/composition#tm-key it uses
rt
in under the info for tm(key)
. There is a link to rt
where it says in the docs "You need to use rt for the locale message returned by tm. see the rt details." but the link to that section of the docs doesn't exist (it tries to navigate to https://vue-i18n.intlify.dev/api/composition.html#rt-message). Trying to use rt
I'm getting a "TypeError: Cannot convert object to primitive value" in one component (elsewher I am using it is fine but in this component which re-renders it leads to an error).Composition API | Vue I18n
Internationalization plugin for Vue.js
Composition API | Vue I18n
Internationalization plugin for Vue.js
2 Replies
Hi @MyetaM. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I’m sorry, but the provided knowledge sources don’t mention vue-i18n’s rt helper, nor do they document its usage or the tm/rt interaction beyond basic i18n setup and common Nuxt i18n patterns. I can’t confirm why that docs link is broken or how rt should be used from these sources.
What the sources do cover:
- How to configure @nuxtjs/i18n via vueI18n: './i18n.config.ts' and defineI18nConfig, which often resolves Nuxt+i18n integration issues. [i18n not working; Numbers/dates fix].
- Typical composition API usage: useI18n(), t(), and patterns for using i18n in components, stores, and validators. [Pinia store; Vuetify rules; Menus/arrays].
Given the lack of info on rt in the sources, a few suggestions within scope:
- Ensure you’re on a compatible vue-i18n version and that your Nuxt i18n is wired through vueI18n: './i18n.config.ts'. [i18n not working].
- If tm returns an object and rt is intended to render it, but it throws “Cannot convert object to primitive value” on re-render, consider guarding the value before rendering, or converting to a string only where appropriate. However, I don’t have a source-backed example for rt usage to share.
If you can share a minimal snippet of the failing component, I can try to map it to the documented t/tm patterns from the sources and suggest a workaround without rt.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@525812137256288266> Kapa.ai is still learning and improving, please let me know how I did by reacting below.