Home > front end >  Website how to switch in both Chinese and English
Website how to switch in both Chinese and English

Time:10-20

Click on the all the content below to switch into Chinese page, click on the English according to the following all in English, is there a better solution

CodePudding user response:

you don't look at my post rate, for the first time send post rate which come of, the

CodePudding user response:

No one, please speed to help

CodePudding user response:

The general idea is to build two website templates, standing group of the two websites, a Chinese website an English site,
Just switch on the front end, change matching HTML elements by using the jquery JS web content
$(" # logo "). The HTML (" title ");
$(" # logo "). The HTML (" English Title ");
I wonder if you'd like to know whether this

CodePudding user response:

reference glenliam reply: 3/f
general idea is to build two website templates, standing group of the two websites, a Chinese website an English site,
Just switch on the front end, change matching HTML elements by using the jquery JS web content
$(" # logo "). The HTML (" title ");
$(" # logo "). The HTML (" English Title ");
I wonder if you'd like to know whether this

Before I set up in both Chinese and English are two sets of templates, two sets of logic, just read the same data, when switching using jquery

CodePudding user response:

Songyajun_zzuli
reference 4 floor response:
Quote: refer to the third floor glenliam response:
general idea is to build two website templates, standing group of the two websites, a Chinese website an English site,
Just switch on the front end, change matching HTML elements by using the jquery JS web content
$(" # logo "). The HTML (" title ");
$(" # logo "). The HTML (" English Title ");
I wonder if you'd like to know whether this

Before I set up in both Chinese and English are two sets of templates, two sets of logic, just read the same data, when switching to use jquery

This update is really too much trouble, if it is more a variety of language is a headache!
I now use the project is in both Chinese and English, and no two sets of templates, only the text and data content of all can be divided into two languages in the resource file,,,,,,, in fact this is also very troublesome!

CodePudding user response:

refer to fifth floor __ laver response:
Quote: refer to 4th floor songyajun_zzuli response:

Quote: refer to the third floor glenliam response:
general idea is to build two website templates, two of the station group of websites, a Chinese website an English site,
Just switch on the front end, change matching HTML elements by using the jquery JS web content
$(" # logo "). The HTML (" title ");
$(" # logo "). The HTML (" English Title ");
I wonder if you'd like to know whether this

Before I set up in both Chinese and English are two sets of templates, two sets of logic, just read the same data, when switching to use jquery

This update is really too much trouble, if it is more a variety of language is a headache!
I now use the project is in both Chinese and English, and no two sets of templates, only the text and data content of all can be divided into two languages in the resource file,,,,,,, in fact this is also very troublesome!

Can't, haven't found a set of perfect correspondence switch in both Chinese and English, also do have relationship with me, now can only use the trouble first ~ ~

CodePudding user response:

Introduce different language configuration file,,,

CodePudding user response:

I am all characters of the JSP page had a in both English and Chinese by hand using a label cover the data dictionary js traversal parsing

CodePudding user response:

Several language versions of the properties in the project configuration file, and then the background reading on the Map object and then stored into the local session cookies or project, the front desk through the label corresponding key value shows data binding,

CodePudding user response:

Configuration file into a different language,,,

CodePudding user response:

In the end how to solve?

CodePudding user response:

We switch in both Chinese and English are two page templates, then by clicking on the switch on the realization of page conversion in both Chinese and English, don't know there is no better way

CodePudding user response:

No, not in

CodePudding user response:

I remember before when writing this thing, is to use a file save those click in both Chinese and English will replace the contents of the switch, and then stored in different objects like this
Let the content: {
En={
Write: 'write'
}

Ch={
Write: 'write'
}
}

Writing the text is
The content [state]. Write
Switch will change the value of the state in both English and Chinese

CodePudding user response:

Configuration file the ideas and then through different key take different content, basically is to do so,

CodePudding user response:

You can consult the vue - i18n using inside put both Chinese and English, respectively, under the different js file
Under such as en. Js
Export the default {
OurTeam: {
Mobile: '12345678915'
}
}
Specific usage using
{{$t (' ourTeam. Mobile ')}}
You just need to do the local switch in both Chinese and English, the language can automatically switch in both Chinese and English,
 
Import useful from '@/i18n/langs/useful. Js'
The import en the from '@/i18n/langs/en. Js'
Vue. Use (VueI18n)


//instantiate the vue - i18n
Const i18n=new VueI18n ({
//from the local store, if there is no default for the Chinese,
//so that we can solve the language after switch, not remember the language of choice, after refresh the page or the default language
The locale:!!!!! SessionStorage. The getItem (' lang) & amp; & SessionStorage. The getItem (' lang ') | | 'en'

Messages: {
'useful' : useful,//Chinese language pack
'en' : en//English language pack
}
})

  • Related