How to internationalize js files in vue using i18n

in my vue project static/js/country_region.js this file is imported into a .vue file to be used as a drop-down list

but my website is multilingual, all introduced i18n, but $t () this syntax can only be used in .vue, how can I use it in this js file

import Vue from "vue";
import store from "../../src/vuex/store"
export default [
  {value: "0",label: Vue.$t("passport.authing")},
  {value: "London",label: "London"},
  {value: "Sydney",label: "Sydney"},
  {value: "Ottawa",label: "Ottawa"},
  {value: "Paris",label: "Paris"},
  {value: "Canberra",label: "Canberra"}
]

if I write this, I will report an error


import i18n from 'i18n'
i18n.t ('.')
try


if you write this, you need to wrap it up, assign it to a variable directly in the new Vue of main.js, and then obtain it from the variable.
such as
window.vm= new Vue ({
/ / separate js in main.js,
{value: '0percent, Label: window.vm.$i18n.t ('passport.authing')}
import Vue from' vue' is not needed.


you can!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be6fe3-30fbc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be6fe3-30fbc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?