vue-element-admin | vue-element-admin i18n
Thisprojectisacollectionofinternationalizedi18nsolutions.Implementedviavue-i18n[1].Sincetheprojectsuiframeworkuseselement,internationalizationalsoneedstobeinternationalized.code[2].Atthesametime,thecurrentlanglanguagesaveinthecookie,andthelastlanguagesettingcanberememberedforopeningthepagenexttime.GloballangCode:@/lang[3]CurrentlysetEnglishandChineselanguages.Meanwhile,importalanguagepackagein@/lang/index.jsforelement-ui.AsynclangTherearesomelangsthatareneededforspecificpages,suchasthe@/view...
This project is a collection of internationalized i18n solutions. Implemented via vue-i18n[1].
Since the projects ui framework uses element, internationalization also needs to be internationalized. code[2]. At the same time, the current lang language save in the cookie, and the last language setting can be remembered for opening the page next time.
Global langCode: @/lang[3] Currently set English and Chinese languages.
Meanwhile, import a language package in @/lang/index.js for element-ui.
Async langThere are some langs that are needed for specific pages, such as the @/views/i18n page, you can use async lang.
import local from ./local this.$i18n.mergeLocaleMessage(en, local.en) this.$i18n.mergeLocaleMessage(zh, local.zh)If you use a component such as select, its value comes through v-for, such as:
<el-select v-model="value"> <el-option v-for="item in options"...