question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

$t is not a function

See original GitHub issue

Hello,

sorry to post this here, i know it’s not the right place but 2 days and i can’t solve my issue. When i use $t like this <h1>{{ $t('home.welcome') }}</h1> in component or child component, i have Uncaught TypeError: _ctx.$t is not a function. Can you explain to me, please ?

Thank you !

“vue”: “^3.0.0” “vue-i18n”: “^9.0.0”

import { createI18n } from 'vue-i18n'
import en from './locales/en.json'
import ja from './locales/ja.json'
export default createI18n({
  legacy: false,
  locale: "en",
  messages: { en, ja }
})
import i18n from './i18n'
const app = createApp(AppVue)
app.use(i18n)
app.mount('#app')

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
danielpetricacommented, Mar 8, 2021

Hi it looks to me that that it could be the same issue I’ve encountered in the past, check if this solution solves it for you https://github.com/intlify/vue-i18n-next/issues/350#issuecomment-782007971

Sorry if I’m not explaining it better but I’m on mobile.

6reactions
kazuponcommented, Mar 9, 2021

Thank you for your feedback!

sorry to post this here, i know it’s not the right place but 2 days and i can’t solve my issue.

Sorry for the Vue I18n docs wasted your time with their unfriendly documentation.

For me, your code looks like it’s using the Composition API. You need to specify globalInjection option to createI18n function if you can use Implicitly the function prefixed with $. 😃 https://vue-i18n.intlify.dev/guide/advanced/composition.html#implicit-with-injected-properties-and-functions

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
Can't understand console error: 'Uncaught TypeError: t is not a ...
I am attempting to host a Ruby on Rails / React app in Heroku. Also of not, I am using the package google-maps-react ......
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >
JavaScript: Uncaught TypeError: n is not a function
Uncaught TypeError : 'n' is not a function: This is a standard JavaScript error when trying to call a function before it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found