vsCode编辑器 快速国际化-以及一些国际化细节

在这里插入图片描述
在这里插入图片描述
i18n.code-snippets 配置

{
  "vue-i18n-mall": {
    "scope": "vue-html",
    "prefix": "vt",
    "body": "\\$t('passenger.$1')",   //passenger-国际化文档名
    "description": "vue i18n mall"
  },
  "vue-i18n-mall-close": {
    "scope": "vue-html",
    "prefix": "vtc",
    "body": "{{\\$t('passenger.$1')}}",
    "description": "vue i18n mall"
  },
  "vue-i18n-mall-js": {
    "scope": "javascript, typescript",
    "prefix": "vt",
    "body": "this.\\$t('passenger.$1')",
    "description": "vue i18n mall"
  },
  "vue-i18n-mall-external": {
    "scope": "javascript, typescript",
    "prefix": "vte",
    "body": "i18n.t('passenger.$1')",
    "description": "vue i18n mall"
  }
}

快捷键:vt+回车 / vtc+回车

//标签:vtc + 回车
<span>{{$t('passenger.rest_tip')}}</span>
//函数里面采用:vt + 回车
this.$t('passenger.rest_tip')

如果带不定的参数形况下的国际化

<span>{{$t('passenger.rest_tip',[depListName])}}</span>
this.$t('passenger.rest_tip',[depListName])

//翻译中的样子
 rest_tip: '是否重置{0}下PC8得设备的店员数据',

//多个的情况
<span>{{$t('passenger.rest_tip',[depListName, depId, dep])}}</span>
 rest_tip: '是否重置{0}下PC8得{1}设备的{2}店员数据',

在js中引入

import i18n from "@/plugins/i18n" // 自己写的i18n配置
i18n.t('alwaysTrue')
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值