Bilingual development ideas

1, set the page file can be used, including js, css, html difference is that when writing the need to write two sets of language text, and then to control the switch through a global variable in the English version of the state show Chinese or English display For example, the following code:

<div > 
    < span v-IF = "isChinese" > 
        I was in the text 
    </ span > 
    < span v-the else > 
        I am English word 
    </ span > 
</ div >

 

2, isChinese this variable must be global, can be obtained at each page, and a page in a replacement of the language, you need to change the value of a global variable to ensure that the jump to other pages later is still capable of in accordance with just select the language display

3, if the text data is returned interface is not required to do isChinese judgment, but need to pass a parameter to the interface, such as is isChinese parameters, interfaces to determine the value of isChinese decided to return to the inside front of the language versions, the front page only need to call data variables can be:

 

<div>
    <span>
       {{data}}
    </span>
</div>

 

Guess you like

Origin www.cnblogs.com/liubingyjui/p/12330960.html
Recommended