Alidoing--using JS to implement multi-language framework, like the Please enter, and Watt platform!

Source: Internet
Author: User

Hello everyone!

Multi-language Implementation case: http://alidoing.com/or http://www.alidoing.com/

Figure: Switching Language interface

JS Code implementation:

1. First create a new object langobj, of course, the property values inside the object is variable, such as array [], are supported.

var langobj= {    "LANHELP1": "Thank you:"    ,"LANHELP2": "provides language translation support!" ,    " Usernamea ":" Account: ",    " Userpassa ":" Password: ",    " Maila ":" Mailbox: ",    " InputName ":" Please enter user name! " ,    " Inputpass ":" Please enter the password! " ,    " Success ":" Success! " ,    " Inouterror ":" The input contains sensitive characters! ",    " pleasewait ":" Please later ...! " ,    " Loginfaild ":" Username and password wrong! "    }

The above is Chinese simplified, but the corresponding value is not the same when it becomes another language!

2. Store the current language value selected by the user, store it as you decide, data can also, when using the database environment is ASP. NET in the case of the JS to consider the order of execution!

Of course can also output like this: Src=js storage path!!!!!!!

document.write (unescape ("%3cscript src=" + src + "' type= ' Text/javascript '%3e%3c/script%3e"));

Next execute the assignment method:

    functionSetlang () {Try {            $("#btnregistgoto"). Val (Alidoinglang.registname); $("#btnlogin"). Val (Alidoinglang.submitelogin); $("#btnbacklogin"). Val (Alidoinglang.backlogin); $("#btnregist"). Val (Alidoinglang.submite); $("#txtnamel"). attr ("placeholder"), Alidoinglang.inputname); $("#txtpassl"). attr ("placeholder"), Alidoinglang.inputpass); $("#txtnamere"). attr ("placeholder"), Alidoinglang.inputname); $("#txtpwdre"). attr ("placeholder"), Alidoinglang.inputpass); $("#txtemail"). attr ("placeholder"), alidoinglang.inputmailaddress);        }        Catch(ex) { }

It's so simple!!!!!!!!!!!!!!!!!!!!!

Advantages and Disadvantages

Advantages: Website Development After the completion of the line if you change the value of the language or add a language when the implementation is very simple: Create a new JS language object file, stored in the language folder, the page new a click Tag, easy to replace, performance consumption on the client, reduce server pressure

Disadvantage: When the page needs to assign a lot of objects, the assignment method is hard to write, performance is reduced, when the page wants to be searched by the search engine, the page is full of tags, no descriptive object, The current search engine system will not be based on the JS execution method later search data (360 search engine at the end of 2012 when said will support cookies and JS) later or no results!!!!

Multi-language Implementation case: http://alidoing.com/or http://www.alidoing.com/

Share code: (Email me: [email protected]) "I'll send you the first time when I'm not busy."

Jquery+ajax+asp.net wrote a generic mail management system written before.

Advantages: Compatible with ie7+, the interface is simple and clear, the development of the project will inevitably meet some messages sent or notified, the system only needs a unique user ID

Send file: source + database SQL.

Other code:

http://10086bank.com/in the Code factory apart from the source of the rest of the source I will clean up!

Code factory can quickly generate html+js+ajax+ low-level +sql code, automatic verification, attachments automatically upload! UI compatible ie7+

Thank you!

Alidoing--using JS to implement multi-language framework, like the Please enter, and Watt platform!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.