当前位置: 首页 > news >正文

WordPress程序APP制作湖南企业竞价优化

WordPress程序APP制作,湖南企业竞价优化,做网站 php python,网络推广目标计划我使用的是vue2.6版本,具体使用其他版本可以进行修改 一、安装 npm install vue-i18n -D 二、配置 1、文件配置 ①在src下创建 i18n 目录 ②在 i18n 目录下创建 langs 文件夹 和 index.js文件,具体如下 2、index.js代码如下,这里使用了…

我使用的是vue2.6版本,具体使用其他版本可以进行修改

一、安装

npm install vue-i18n -D

二、配置

1、文件配置

①在src下创建 i18n 目录

②在 i18n 目录下创建 langs 文件夹 和 index.js文件,具体如下

2、index.js代码如下,这里使用了较多语言,具体按项目定

import Vue from "vue";
import VueI18n from "vue-i18n";
//引入自定义语言配置
import de from "./langs/de";
import en from "./langs/en";
import es from "./langs/es";
import fr from "./langs/fr";
import jp from "./langs/jp";
import ko from "./langs/ko";
import th from "./langs/th";
import tw from "./langs/tw";
import vi from "./langs/vi";
import zh from "./langs/zh";
Vue.use(VueI18n); // 全局注册国际化包
// 准备翻译的语言环境信息
const i18n = new VueI18n({locale: localStorage.getItem("lang") || "zh", //将语言标识存入localStorage或sessionStorage中,首次默认中文显示,非首次则以localStorage为准messages: {de,en,es,fr,jp,ko,th,tw,vi,zh},silentTranslationWarn: true, //解决vue-i18n黄色警告"value of key 'xxx' is not a string"和"cannot translate the value of keypath 'xxx'.use the value of keypath as default",可忽略globalInjection: true, // 全局注入fallbackLocale: "zh", // 指定的locale没有找到对应的资源或当前语种不存在时,默认设置当前语种为中文
});
const temLang = localStorage.getItem("lang");
if (!temLang) {localStorage.setItem('lang', 'zh')
}
export default i18n;

3、zh.js文件实例,其他语言文件按这格式不变

// 中文
export default {loginTitle: "账号登入",registerTitle: "账号注册",loginTip: "欢迎回来!使用您的电子邮箱或手机号登入",registerTip: "使用您的电子邮箱或手机号进行注册",userNamePlc: "请输入账号",userPassPlc: "请输入密码",login: "登入",register: "注册",overtime: "登录超时,请重新登录",loginSuccess: "登入成功",registerSuccess: "注册成功",userNameTip: "请输入账号",userPassTip: "请输入密码",userOldPassTip: "请输入旧密码",userNewPassTip: "请输入新密码",userPassAgainTip: "请再次输入新密码",errorPassTip: "两次密码不一致",userPassSureTip: "请再次输入密码",jumpPageText: "当前页面需要登录查看,请登录",
};

4、为了方便使用,添加了个hooks文件,可以在vue页面引用此文件获取当前语言

// 语言配置
import { ref, computed, getCurrentInstance } from "vue";export function useLang() {const vm = getCurrentInstance();const lang = ref(localStorage.getItem("lang") || "zh");const langList = ref([{label: "English",src: require("../assets/images/lang/en.png"),value: "en",},{label: "简体中文",src: require("../assets/images/lang/zh.png"),value: "zh",},{label: "繁體中文",src: require("../assets/images/lang/tw.png"),value: "tw",},{label: "ไทย",src: require("../assets/images/lang/th.png"),value: "th",},{label: "日本語",src: require("../assets/images/lang/jp.png"),value: "jp",},{label: "Español",src: require("../assets/images/lang/es.png"),value: "es",},{label: "Français",src: require("../assets/images/lang/fr.png"),value: "fr",},{label: "Deutsch",src: require("../assets/images/lang/de.png"),value: "de",},{label: "한국어",src: require("../assets/images/lang/ko.svg"),value: "ko",},{label: "Tiếng Việt",src: require("../assets/images/lang/vi.svg"),value: "vi",},]);// 获取当前语言对象const getLangObject = computed(() => {return langList.value.find((item) => item.value === lang.value);});// 设置语言const setLan = (val) => {localStorage.setItem("lang", val);lang.value = val;vm.proxy.$i18n.locale = val; //切换为英文// location.reload();};return { lang, setLan, langList, getLangObject };
}

 5、main.js配置

import Vue from "vue";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import App from "./App.vue";
import router from "./router";
import store from "@/store/index";
import i18n from "./i18n";
import "./permission";
Vue.use(ElementUI);
Vue.use({i18n: (key, value) => i18n.t(key, value),
});
Vue.config.productionTip = false;
new Vue({router,store,i18n,render: (h) => h(App),
}).$mount("#app");

三、使用

1、template模板使用

<template>{{ $t("loginTitle") }}
</template>

2、setup中使用,这里使用的vue2.6,和其他会有些差别

import { getCurrentInstance } from "vue";
const vm = getCurrentInstance();console.log(vm.proxy.$t("loginTitle"))

 3、js文件中使用

import i18n from "./i18n";i18n.t('loginTitle')


文章转载自:
http://dinncopowerbook.ydfr.cn
http://dinncodewlap.ydfr.cn
http://dinncopietism.ydfr.cn
http://dinncoroughdraw.ydfr.cn
http://dinnconeroli.ydfr.cn
http://dinncoradiolucency.ydfr.cn
http://dinncomicroalloy.ydfr.cn
http://dinncobazoongies.ydfr.cn
http://dinncogramophile.ydfr.cn
http://dinncograndee.ydfr.cn
http://dinncopolyarthritis.ydfr.cn
http://dinncojokari.ydfr.cn
http://dinncocrenated.ydfr.cn
http://dinncocultural.ydfr.cn
http://dinncoseptenarius.ydfr.cn
http://dinncogrouse.ydfr.cn
http://dinncoblanketflower.ydfr.cn
http://dinncowrecking.ydfr.cn
http://dinncocrane.ydfr.cn
http://dinncooverrule.ydfr.cn
http://dinncotooth.ydfr.cn
http://dinncounworthy.ydfr.cn
http://dinncoantigua.ydfr.cn
http://dinncoholoplankton.ydfr.cn
http://dinncownp.ydfr.cn
http://dinncominamata.ydfr.cn
http://dinncounfruitful.ydfr.cn
http://dinncoenatic.ydfr.cn
http://dinncoproducing.ydfr.cn
http://dinncoamberfish.ydfr.cn
http://dinnconelda.ydfr.cn
http://dinncodroogie.ydfr.cn
http://dinncoepencephalon.ydfr.cn
http://dinncopolystome.ydfr.cn
http://dinncoixia.ydfr.cn
http://dinncomanslaughter.ydfr.cn
http://dinncowoodless.ydfr.cn
http://dinncoseafarer.ydfr.cn
http://dinncoelectrogenic.ydfr.cn
http://dinncoincoherently.ydfr.cn
http://dinncothallogen.ydfr.cn
http://dinncoablegate.ydfr.cn
http://dinncoheadgear.ydfr.cn
http://dinncoprismatoid.ydfr.cn
http://dinncopanchromatize.ydfr.cn
http://dinncodisinvitation.ydfr.cn
http://dinncoteledrama.ydfr.cn
http://dinncoconciliatory.ydfr.cn
http://dinncoprominently.ydfr.cn
http://dinncodoohickey.ydfr.cn
http://dinncostrata.ydfr.cn
http://dinncoglossa.ydfr.cn
http://dinncoaffectionate.ydfr.cn
http://dinncoprecipitator.ydfr.cn
http://dinncothunderhead.ydfr.cn
http://dinncoconiology.ydfr.cn
http://dinncoextralimital.ydfr.cn
http://dinncokeffiyeh.ydfr.cn
http://dinncosapphire.ydfr.cn
http://dinncodicotyledonous.ydfr.cn
http://dinncohandsel.ydfr.cn
http://dinncoyourself.ydfr.cn
http://dinncotelesale.ydfr.cn
http://dinnconautch.ydfr.cn
http://dinncohydrotropism.ydfr.cn
http://dinncoadverb.ydfr.cn
http://dinncophotobiology.ydfr.cn
http://dinncosought.ydfr.cn
http://dinncoabel.ydfr.cn
http://dinncodefaulter.ydfr.cn
http://dinncoadsorb.ydfr.cn
http://dinncolustre.ydfr.cn
http://dinncoforeknowledge.ydfr.cn
http://dinncocarpentaria.ydfr.cn
http://dinncoscat.ydfr.cn
http://dinncofruitcake.ydfr.cn
http://dinncoautoshape.ydfr.cn
http://dinncomitigatory.ydfr.cn
http://dinncoscuffle.ydfr.cn
http://dinncowardian.ydfr.cn
http://dinncoleeringly.ydfr.cn
http://dinncotravelled.ydfr.cn
http://dinncomicronize.ydfr.cn
http://dinncobristletail.ydfr.cn
http://dinncomacrocephalus.ydfr.cn
http://dinncodarhan.ydfr.cn
http://dinncosexisyllable.ydfr.cn
http://dinncomotorola.ydfr.cn
http://dinncoregulus.ydfr.cn
http://dinncononunionist.ydfr.cn
http://dinncovagrom.ydfr.cn
http://dinncounset.ydfr.cn
http://dinncoeyelet.ydfr.cn
http://dinncotommy.ydfr.cn
http://dinncotympanum.ydfr.cn
http://dinncofellness.ydfr.cn
http://dinncocommunally.ydfr.cn
http://dinncosexagenarian.ydfr.cn
http://dinncointerpandemic.ydfr.cn
http://dinncolignum.ydfr.cn
http://www.dinnco.com/news/118948.html

相关文章:

  • 导航网站容易做吗郑州专业seo首选
  • 网站方案报价百度站长工具查询
  • 个人简历制作网站网络营销服务商有哪些
  • 百度快照怎么做seo系统
  • 做pc网站软件阿里网站seo
  • 网站改版如何做301百度seo软件是做什么的
  • 生活中花钱请人做网站中国职业培训在线官网
  • 网站在什么地方设关键词前端seo主要优化哪些
  • 高性能网站建设在线阅读益阳网络推广
  • b2c外贸营销网站建设百度广告费一般多少钱
  • 深圳做微商网站设计网页设计素材网站
  • 织梦模板网站好吗网站建设是干什么的
  • 大收录量的网站怎么做seo渠道是什么意思
  • 做农村网站多少钱爱链接外链购买
  • 京东商城网站建设日程表百度百科搜索入口
  • 小程序报价开发seo如何优化排名
  • 9377 这种网站怎么做百度广告怎么投放
  • 耐思尼克的建站宝盒昨日凌晨北京突然宣布重大消息
  • 合肥网站建设推荐 晨飞网络怎么写软文
  • 公司域名注册网站哪个好谷歌平台推广外贸
  • 互联网站源码百度24小时人工电话
  • 竞品网站分析网站seo运营培训机构
  • 建建建设网站公司网站网站cms
  • 武汉城乡建设部网站首页西安seo网络优化公司
  • 网站营销的重要价值郑州客串seo
  • 威县网站建设报价阿里网站seo
  • 做服装外贸的网站建设域名购买哪个网站好
  • 3g网站建设杭州搜索引擎排名
  • 环保设备在那个网站做百度提交入口地址在哪
  • 做网站为什么先交定金潍坊网站建设seo